Spaces:
Sleeping
Sleeping
Commit ·
8732927
1
Parent(s): e5b884f
fix cache issue
Browse files- Dockerfile +13 -4
Dockerfile
CHANGED
|
@@ -13,11 +13,20 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 13 |
COPY . .
|
| 14 |
|
| 15 |
# Create necessary directories
|
| 16 |
-
RUN mkdir -p app/uploads app/data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Set environment variables
|
| 19 |
-
ENV PYTHONPATH=/app
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Expose the port that Hugging Face Spaces expects
|
| 23 |
EXPOSE 7860
|
|
@@ -27,4 +36,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
| 27 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 28 |
|
| 29 |
# Command to run the FastAPI application
|
| 30 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 13 |
COPY . .
|
| 14 |
|
| 15 |
# Create necessary directories
|
| 16 |
+
RUN mkdir -p app/uploads app/data /app/huggingface_cache
|
| 17 |
+
|
| 18 |
+
# ----------------------------
|
| 19 |
+
# Add a non-root user (optional but recommended)
|
| 20 |
+
# ----------------------------
|
| 21 |
+
RUN useradd -m -u 1000 user
|
| 22 |
+
RUN chown -R user:user /app
|
| 23 |
+
USER user
|
| 24 |
|
| 25 |
# Set environment variables
|
| 26 |
+
ENV PYTHONPATH=/app \
|
| 27 |
+
PORT=7860 \
|
| 28 |
+
HF_HOME=/app/huggingface_cache \
|
| 29 |
+
TRANSFORMERS_CACHE=/app/huggingface_cache
|
| 30 |
|
| 31 |
# Expose the port that Hugging Face Spaces expects
|
| 32 |
EXPOSE 7860
|
|
|
|
| 36 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 37 |
|
| 38 |
# Command to run the FastAPI application
|
| 39 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|