Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +6 -9
Dockerfile
CHANGED
|
@@ -5,20 +5,17 @@ FROM python:3.10-slim
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Create a non-root user for better security
|
| 8 |
-
RUN addgroup --system app && adduser --system --
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
ENV HF_HOME=/
|
| 12 |
-
|
| 13 |
-
# Create the cache directory and ensure the 'app' user owns it
|
| 14 |
-
RUN mkdir -p /app/cache && chown -R app:app /app/cache
|
| 15 |
|
| 16 |
# Copy the requirements file and install dependencies
|
| 17 |
-
COPY
|
| 18 |
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
| 19 |
|
| 20 |
# Copy the rest of your application code
|
| 21 |
-
COPY
|
| 22 |
|
| 23 |
# Switch to the non-root user
|
| 24 |
USER app
|
|
@@ -27,4 +24,4 @@ USER app
|
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
# Command to run the application using the standard HF port
|
| 30 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Create a non-root user for better security
|
| 8 |
+
RUN addgroup --system app && adduser --system --ingroup app app
|
| 9 |
|
| 10 |
+
# --- Use a container-writable cache directory ---
|
| 11 |
+
ENV HF_HOME=/tmp/huggingface
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Copy the requirements file and install dependencies
|
| 14 |
+
COPY ./requirements.txt /app/requirements.txt
|
| 15 |
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
| 16 |
|
| 17 |
# Copy the rest of your application code
|
| 18 |
+
COPY . /app
|
| 19 |
|
| 20 |
# Switch to the non-root user
|
| 21 |
USER app
|
|
|
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
# Command to run the application using the standard HF port
|
| 27 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|