Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -16
Dockerfile
CHANGED
|
@@ -4,29 +4,20 @@ FROM python:3.11-slim
|
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
# Set
|
| 8 |
ENV HF_HOME /code/.cache
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
RUN mkdir -p /code/.cache && chown -R python:python /code/.cache
|
| 14 |
-
# --- ********************* ---
|
| 15 |
|
| 16 |
-
# Copy
|
| 17 |
COPY ./requirements.txt /code/requirements.txt
|
| 18 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 19 |
|
| 20 |
-
# Copy
|
| 21 |
COPY ./app.py /code/app.py
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
# Switch to the non-root 'python' user to run the application securely
|
| 25 |
-
USER python
|
| 26 |
-
# --- ************************************** ---
|
| 27 |
-
|
| 28 |
-
# Expose the port the app runs on
|
| 29 |
EXPOSE 8000
|
| 30 |
-
|
| 31 |
-
# Command to run the application
|
| 32 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Set environment variable for Hugging Face cache
|
| 8 |
ENV HF_HOME /code/.cache
|
| 9 |
|
| 10 |
+
# Create the cache directory and make it fully writable.
|
| 11 |
+
# This is a simpler and more direct fix for the permission error.
|
| 12 |
+
RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Copy and install requirements
|
| 15 |
COPY ./requirements.txt /code/requirements.txt
|
| 16 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 17 |
|
| 18 |
+
# Copy application code
|
| 19 |
COPY ./app.py /code/app.py
|
| 20 |
|
| 21 |
+
# Expose port and run application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
EXPOSE 8000
|
|
|
|
|
|
|
| 23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|