# Python Backend Dockerfile FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Set ffmpeg paths ENV FFMPEG_PATH=/usr/bin/ffmpeg ENV FFPROBE_PATH=/usr/bin/ffprobe # Copy requirements first for better Docker layer caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY backend/ ./backend/ COPY main.py . COPY public/ ./public/ # Create necessary directories RUN mkdir -p downloads database # Create non-root user RUN groupadd -r quixotic && useradd -r -g quixotic quixotic # Change ownership of app directory RUN chown -R quixotic:quixotic /app USER quixotic # Expose port EXPOSE 8000 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=3)" # Start the application CMD ["python", "main.py"]