Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +23 -20
Dockerfile
CHANGED
|
@@ -1,21 +1,24 @@
|
|
| 1 |
-
# Use an official Python base image
|
| 2 |
-
FROM python:3.11-slim
|
| 3 |
-
|
| 4 |
-
# Set the working directory inside the container
|
| 5 |
-
WORKDIR /code
|
| 6 |
-
|
| 7 |
-
#
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
#
|
|
|
|
|
|
|
|
|
|
| 21 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
+
# Use an official Python base image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory inside the container
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
# --- *** ADD THIS LINE *** ---
|
| 8 |
+
# Set an environment variable to tell Hugging Face where to cache models.
|
| 9 |
+
# This avoids permission errors by using a local, writable directory.
|
| 10 |
+
ENV HF_HOME /code/.cache
|
| 11 |
+
# --- ********************* ---
|
| 12 |
+
|
| 13 |
+
# Copy the requirements file and install dependencies
|
| 14 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 15 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 16 |
+
|
| 17 |
+
# Copy the rest of the application code
|
| 18 |
+
COPY ./app.py /code/app.py
|
| 19 |
+
|
| 20 |
+
# Expose the port the app runs on
|
| 21 |
+
EXPOSE 8000
|
| 22 |
+
|
| 23 |
+
# Command to run the application
|
| 24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|