ethnmcl commited on
Commit
2ec6227
·
verified ·
1 Parent(s): e1febea

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -6
Dockerfile CHANGED
@@ -5,22 +5,32 @@ ENV PIP_NO_CACHE_DIR=1 \
5
  PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1
7
 
8
- # System deps
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy & install
 
 
 
 
 
 
 
 
 
 
 
 
14
  WORKDIR /app
15
  COPY requirements.txt /app/requirements.txt
16
  RUN pip install -r /app/requirements.txt
17
 
18
- # Copy app
19
  COPY main.py /app/main.py
20
 
21
- # Spaces default port
22
  EXPOSE 7860
23
  ENV PORT=7860
24
-
25
- # Start FastAPI with uvicorn
26
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
5
  PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1
7
 
8
+ # ---- System deps ----
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # ---- Writable caches (fixes /.cache permission errors) ----
14
+ # Make HOME=/data so default "~/.cache" resolves under /data
15
+ ENV HOME=/data \
16
+ XDG_CACHE_HOME=/data/.cache \
17
+ HF_HOME=/data/hf \
18
+ HF_HUB_CACHE=/data/hf/hub \
19
+ HUGGINGFACE_HUB_CACHE=/data/hf/hub \
20
+ TRANSFORMERS_CACHE=/data/transformers_cache
21
+
22
+ RUN mkdir -p /data/.cache /data/hf/hub /data/transformers_cache /app && \
23
+ chmod -R 777 /data
24
+
25
+ # ---- Python deps ----
26
  WORKDIR /app
27
  COPY requirements.txt /app/requirements.txt
28
  RUN pip install -r /app/requirements.txt
29
 
30
+ # ---- App ----
31
  COPY main.py /app/main.py
32
 
 
33
  EXPOSE 7860
34
  ENV PORT=7860
 
 
35
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
36
+