FROM python:3.9-slim WORKDIR /code # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Copy requirements first to leverage Docker cache COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create necessary directories RUN mkdir -p /code/music /code/static /code/templates # Set environment variables ENV PORT=7860 ENV PYTHONUNBUFFERED=1 ENV FLASK_ENV=production # Set permissions RUN chmod -R 755 /code EXPOSE 7860 CMD ["python", "app.py"]