Spaces:
Sleeping
Sleeping
| # 1. Use a lightweight Python base image | |
| FROM python:3.10-slim | |
| # 2. Install FFmpeg (Crucial for your video and audio processing!) | |
| RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 && rm -rf /var/lib/apt/lists/* | |
| # 3. Create a non-root user (Hugging Face requires this for security) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 4. Set the working directory | |
| WORKDIR $HOME/app | |
| # 5. Copy your requirements and install them | |
| COPY --chown=user requirement.txt . | |
| RUN pip install --no-cache-dir -r requirement.txt | |
| # 6. Copy all your code and UI files into the container | |
| COPY --chown=user . . | |
| # 7. Create the temporary folders so the app doesn't crash on upload | |
| RUN mkdir -p uploads processed_frames | |
| # 8. Expose port 7860 (This is the specific port Hugging Face listens to) | |
| EXPOSE 7860 | |
| # 9. Start your Flask application | |
| CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "app:app"] |