victor-johnson commited on
Commit
510de5b
·
verified ·
1 Parent(s): 9d6cb48

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -16
Dockerfile CHANGED
@@ -1,32 +1,20 @@
1
- # 1. Base image
2
  FROM python:3.10-slim
3
-
4
- # 2. Set working directory
5
  WORKDIR /app
6
 
7
- # 3. Create and chown a cache dir
8
- RUN mkdir -p /app/.cache/transformers \
9
- && chmod -R 777 /app/.cache
10
-
11
- # 4. Point HF/Transformers at it
12
  ENV HF_HOME=/app/.cache
13
- ENV TRANSFORMERS_CACHE=/app/.cache/transformers
14
  ENV XDG_CACHE_HOME=/app/.cache
15
 
16
- # 5. Install git & other system deps
17
  RUN apt-get update && \
18
  apt-get install -y git && \
19
  rm -rf /var/lib/apt/lists/*
20
-
21
- # 6. Install Python deps
22
  COPY requirements.txt .
23
  RUN pip install --no-cache-dir -r requirements.txt
24
 
25
- # 7. Copy your code
26
  COPY . .
27
 
28
- # 8. Expose the port
29
  EXPOSE 7860
30
-
31
- # 9. Launch Uvicorn
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10-slim
 
 
2
  WORKDIR /app
3
 
4
+ # 1️⃣ Create a writable cache and point HF libs at it
5
+ RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
 
 
 
6
  ENV HF_HOME=/app/.cache
 
7
  ENV XDG_CACHE_HOME=/app/.cache
8
 
9
+ # 2️⃣ Install git, Python deps
10
  RUN apt-get update && \
11
  apt-get install -y git && \
12
  rm -rf /var/lib/apt/lists/*
 
 
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # 3️⃣ Copy your FastAPI code
17
  COPY . .
18
 
 
19
  EXPOSE 7860
 
 
20
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]