Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +10 -14
Dockerfile
CHANGED
|
@@ -4,25 +4,21 @@ FROM python:3.11-slim
|
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
WORKDIR /home/appuser/app
|
| 13 |
-
USER appuser
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
# Copy the rest of your app's code
|
| 22 |
-
COPY --chown=appuser:appuser . .
|
| 23 |
|
| 24 |
# Expose the port the app runs on
|
| 25 |
EXPOSE 7860
|
| 26 |
|
| 27 |
-
# Command to run the
|
| 28 |
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# --- ADD THIS LINE ---
|
| 8 |
+
# Set a writable cache directory for Hugging Face models to solve permission errors
|
| 9 |
+
ENV HF_HOME=/tmp/.cache/huggingface
|
| 10 |
|
| 11 |
+
# Copy the requirements file into the container
|
| 12 |
+
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Install any needed packages specified in requirements.txt
|
| 15 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 16 |
|
| 17 |
+
# Copy the rest of your app's code (app.py and the utils folder)
|
| 18 |
+
COPY . /code/
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Expose the port the app runs on
|
| 21 |
EXPOSE 7860
|
| 22 |
|
| 23 |
+
# Command to run the uvicorn server for FastAPI
|
| 24 |
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|