Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -3
Dockerfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
#
|
|
|
2 |
FROM python:3.9
|
3 |
|
4 |
# Create a working directory
|
@@ -11,8 +12,18 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
11 |
# Copy the rest of your code
|
12 |
COPY . .
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
EXPOSE 7860
|
16 |
|
17 |
-
#
|
18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Dockerfile
|
2 |
+
|
3 |
FROM python:3.9
|
4 |
|
5 |
# Create a working directory
|
|
|
12 |
# Copy the rest of your code
|
13 |
COPY . .
|
14 |
|
15 |
+
############################################
|
16 |
+
# 1) Tell Transformers & HF libraries to use /app/.cache instead of /.cache
|
17 |
+
ENV HF_HOME=/app/.cache/huggingface
|
18 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
19 |
+
ENV TORCH_HOME=/app/.cache/torch
|
20 |
+
|
21 |
+
# 2) Make the .cache directories
|
22 |
+
RUN mkdir -p /app/.cache/huggingface
|
23 |
+
RUN mkdir -p /app/.cache/torch
|
24 |
+
|
25 |
+
# Expose port 7860 for HF Spaces
|
26 |
EXPOSE 7860
|
27 |
|
28 |
+
# Start FastAPI via uvicorn on port 7860
|
29 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|