Spaces:
Sleeping
Sleeping
Upload Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Start with an official Python base image.
|
| 2 |
+
# Using a "slim" version is a good practice for smaller container sizes.
|
| 3 |
+
FROM python:3.11-slim
|
| 4 |
+
|
| 5 |
+
# Set the working directory inside the container.
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
# Copy the requirements file into the container.
|
| 9 |
+
COPY requirements.txt .
|
| 10 |
+
|
| 11 |
+
# Install the Python dependencies.
|
| 12 |
+
# The `--no-cache-dir` flag is a best practice for smaller Docker images.
|
| 13 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy the rest of your application code into the container.
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Expose the port that the application will run on.
|
| 19 |
+
# Hugging Face Spaces automatically provides a PORT variable, typically 7860.
|
| 20 |
+
# FastAPI will run on this port inside the container.
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
|
| 23 |
+
# The command to run your application when the container starts.
|
| 24 |
+
# We use Gunicorn as a robust production server.
|
| 25 |
+
CMD ["gunicorn", "-w", "1", "--preload", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:7860", "main:app"]
|