Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -12
Dockerfile
CHANGED
|
@@ -1,25 +1,22 @@
|
|
| 1 |
|
| 2 |
-
Use a stable and slim Python base image
|
| 3 |
FROM python:3.9-slim
|
| 4 |
|
| 5 |
-
Set the working directory inside the container to /app
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
Copy the requirements file first to leverage Docker's layer caching.
|
| 9 |
-
This way, dependencies are only re-installed if requirements.txt changes.
|
| 10 |
COPY requirements.txt .
|
| 11 |
|
| 12 |
-
Install the Python dependencies specified in the requirements file
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
-
Copy all other application files (app.py, model .joblib file, etc.) into the container
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
Expose the port that Hugging Face Spaces uses to run the application
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
-
Define the command to run the application using Gunicorn, a production-ready web server.
|
| 22 |
-
-w 2
|
| 23 |
-
-b 0.0.0.0:7860: Binds the server to port 7860, making it accessible from outside the container.
|
| 24 |
-
app:app: Specifies to run the 'app' Flask instance found in the 'app.py' file.
|
| 25 |
-
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0
|
|
|
|
| 1 |
|
| 2 |
+
#Use a stable and slim Python base image
|
| 3 |
FROM python:3.9-slim
|
| 4 |
|
| 5 |
+
#Set the working directory inside the container to /app
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
#Copy the requirements file first to leverage Docker's layer caching.
|
| 9 |
+
#This way, dependencies are only re-installed if requirements.txt changes.
|
| 10 |
COPY requirements.txt .
|
| 11 |
|
| 12 |
+
#Install the Python dependencies specified in the requirements file
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
+
#Copy all other application files (app.py, model .joblib file, etc.) into the container
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
+
#Expose the port that Hugging Face Spaces uses to run the application
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
+
#Define the command to run the application using Gunicorn, a production-ready web server.
|
| 22 |
+
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|
|
|
|