fix: update Dockerfile to use Python 3.10 and improve comments
Browse files- Dockerfile +20 -16
Dockerfile
CHANGED
|
@@ -1,25 +1,29 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
-
# Install
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
# Set working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
# Copy requirements
|
| 13 |
-
COPY requirements.txt .
|
| 14 |
|
| 15 |
-
# Install dependencies
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
-
# Copy
|
| 19 |
-
COPY .
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
EXPOSE
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
|
|
|
|
|
|
|
|
| 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
|