Spaces:
Sleeping
Sleeping
Changed docker file
Browse files- Dockerfile +17 -5
Dockerfile
CHANGED
|
@@ -1,13 +1,25 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
COPY . .
|
| 10 |
|
|
|
|
| 11 |
EXPOSE 7860
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dockerfile
|
| 2 |
|
| 3 |
+
# Use an official Python runtime as a parent image
|
| 4 |
+
FROM python:3.12-slim
|
| 5 |
|
| 6 |
+
# Set the working directory in the container
|
| 7 |
+
WORKDIR /app
|
| 8 |
|
| 9 |
+
# Copy the requirements file into the container
|
| 10 |
+
COPY requirements.txt .
|
| 11 |
|
| 12 |
+
# Install any needed packages specified in requirements.txt
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy the rest of the application's code into the container
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
+
# Make port 7860 available to the world outside this container
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
+
# Command to run the application using Gunicorn
|
| 22 |
+
# This is a robust way to run FastAPI/Flask in production.
|
| 23 |
+
# It starts 4 worker processes to handle requests.
|
| 24 |
+
# The app:app part refers to the file 'app.py' and the FastAPI instance 'app'.
|
| 25 |
+
CMD ["gunicorn", "--workers", "4", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "app:app"]
|