JJTsao commited on
Commit
38e3da4
·
verified ·
1 Parent(s): b68e1c5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -1,19 +1,22 @@
1
- # Use a slim Python base image
2
  FROM python:3.10-slim
3
 
4
- # Set working directory
 
 
5
  WORKDIR /app
6
 
7
- # Install Python dependencies
 
 
 
 
 
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Copy all project files into the container
12
  COPY . .
13
 
14
- # Set environment to unbuffered (cleaner logs)
15
  ENV PYTHONUNBUFFERED=1
16
 
17
- # Run FastAPI app on port 7860 (required by HF Spaces)
18
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
19
-
 
1
+ # Use slim base image
2
  FROM python:3.10-slim
3
 
4
+ # Create a dedicated cache directory and assign permissions
5
+ RUN mkdir -p /home/user/.cache && chmod -R 777 /home/user/.cache
6
+
7
  WORKDIR /app
8
 
9
+ # Set cache env vars **before** installing anything
10
+ ENV HF_HOME=/home/user/.cache/huggingface \
11
+ TRANSFORMERS_CACHE=/home/user/.cache/huggingface \
12
+ SENTENCE_TRANSFORMERS_HOME=/home/user/.cache/huggingface
13
+
14
+ # Install dependencies
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
 
18
  COPY . .
19
 
 
20
  ENV PYTHONUNBUFFERED=1
21
 
 
22
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]