benkada commited on
Commit
ba923db
Β·
verified Β·
1 Parent(s): d83918d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -4
Dockerfile CHANGED
@@ -1,12 +1,23 @@
 
1
  FROM python:3.9-slim
2
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
- COPY requirements.txt .
5
 
6
- # Install packages system-wide
7
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
8
 
9
  COPY . .
10
 
11
  EXPOSE 8000
12
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # ── Dockerfile ─────────────────────────────────────────────
2
  FROM python:3.9-slim
3
 
4
+ # 1️⃣ Set a writable cache location for πŸ€— Transformers
5
+ ENV TRANSFORMERS_CACHE=/app/.cache/transformers
6
+
7
+ # (optional good practices)
8
+ ENV PYTHONDONTWRITEBYTECODE=1 \
9
+ PYTHONUNBUFFERED=1
10
+
11
  WORKDIR /app
 
12
 
13
+ # 2️⃣ Make sure the directory actually exists
14
+ RUN mkdir -p $TRANSFORMERS_CACHE
15
+
16
+ COPY requirements.txt .
17
+ RUN pip install --no-cache-dir --upgrade pip \
18
+ && pip install --no-cache-dir -r requirements.txt
19
 
20
  COPY . .
21
 
22
  EXPOSE 8000
23
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]