Advertisement
Guest User

Speakr Dockerfile [UNOFFICIAL]

a guest
May 5th, 2025
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | Source Code | 0 0
  1. FROM python:3.11-slim
  2.  
  3. # Set working directory to match the expected path in the application
  4. WORKDIR /opt/transcription-app
  5.  
  6. # Set environment variables
  7. ENV PYTHONDONTWRITEBYTECODE=1 \
  8. PYTHONUNBUFFERED=1 \
  9. FLASK_APP=app.py \
  10. FLASK_ENV=production
  11.  
  12. # Install system dependencies
  13. RUN apt-get update && apt-get install -y --no-install-recommends \
  14. gcc \
  15. && rm -rf /var/lib/apt/lists/*
  16.  
  17. # Copy requirements and install Python dependencies
  18. COPY requirements.txt .
  19. RUN pip install --no-cache-dir -r requirements.txt
  20.  
  21. # Create directories for uploads and database
  22. RUN mkdir -p /opt/transcription-app/uploads /opt/transcription-app/instance
  23. RUN chmod 755 /opt/transcription-app/uploads /opt/transcription-app/instance
  24.  
  25. # Copy application files
  26. COPY app.py reset_db.py create_admin.py ./
  27. COPY templates ./templates/
  28.  
  29. # Make scripts executable
  30. RUN chmod +x create_admin.py reset_db.py
  31.  
  32. # Create a non-root user for security
  33. RUN adduser --disabled-password --gecos '' appuser
  34. RUN chown -R appuser:appuser /opt/transcription-app
  35. USER appuser
  36.  
  37. # Expose the application port
  38. EXPOSE 8899
  39.  
  40. # Command to run the application with Gunicorn
  41. CMD ["gunicorn", "--workers", "3", "--bind", "0.0.0.0:8899", "--timeout", "600", "app:app"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement