Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +27 -0
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies required by the app, especially ffmpeg
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && \
|
| 9 |
+
rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Copy the requirements file into the container
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
|
| 14 |
+
# Install any needed packages specified in requirements.txt
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Copy the rest of the application's code into the container
|
| 18 |
+
# This includes app.py and the 'static' folder
|
| 19 |
+
COPY . .
|
| 20 |
+
|
| 21 |
+
# Tell Docker that the container listens on this port (Hugging Face standard)
|
| 22 |
+
EXPOSE 7860
|
| 23 |
+
|
| 24 |
+
# Define the command to run the application using Gunicorn
|
| 25 |
+
# Binds to all network interfaces on port 7860
|
| 26 |
+
# --workers 1 is safe for free tiers. --threads 4 helps handle concurrent requests.
|
| 27 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "app:app"]
|