devusman commited on
Commit
4973717
·
1 Parent(s): c187eb7

fix: update Dockerfile to use Python 3.10 and improve comments

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -16
Dockerfile CHANGED
@@ -1,25 +1,29 @@
1
- # Use lightweight Python image
2
- FROM python:3.11-slim
3
 
4
- # Install ffmpeg (needed by yt-dlp)
5
- RUN apt-get update && apt-get install -y \
6
- ffmpeg \
7
- && rm -rf /var/lib/apt/lists/*
 
 
8
 
9
- # Set working directory
10
  WORKDIR /app
11
 
12
- # Copy requirements first
13
- COPY requirements.txt .
14
 
15
- # Install dependencies
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
- # Copy project files
19
- COPY . .
20
 
21
- # Expose port for Render
22
- EXPOSE 8080
23
 
24
- # Start Flask app directly
25
- CMD ["python", "app.py"]
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim-buster
3
 
4
+ # 1. Install FFmpeg
5
+ # Debian/Ubuntu based images allow easy installation via apt
6
+ # ffmpeg is essential for the conversion process
7
+ RUN apt-get update && \
8
+ apt-get install -y ffmpeg && \
9
+ rm -rf /var/lib/apt/lists/*
10
 
11
+ # Set the working directory in the container
12
  WORKDIR /app
13
 
14
+ # 2. Copy requirements file and install dependencies
15
+ COPY requirements.txt /app/requirements.txt
16
 
17
+ # Install Python dependencies, including Gunicorn for production server
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # 3. Copy the application code
21
+ COPY ffmpeg_service.py /app/
22
 
23
+ # Port 8080 is the standard port for Hugging Face Spaces (hardcoded in CMD)
24
+ EXPOSE 5001
25
 
26
+ # 4. Run the Flask application using Gunicorn
27
+ # Binds to 0.0.0.0:8080 as required by HF Spaces
28
+ # Format: 'module_name:app_variable_name' -> 'ffmpeg_service:ffmpeg_app'
29
+ CMD exec gunicorn --bind 0.0.0.0:5001 --workers 2 ffmpeg_service:ffmpeg_app