plarnholt commited on
Commit
0db58b4
·
verified ·
1 Parent(s): b29ecd9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -3
Dockerfile CHANGED
@@ -1,12 +1,13 @@
1
  FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
 
2
  ENV DEBIAN_FRONTEND=noninteractive \
3
  PYTHONUNBUFFERED=1 \
4
  PIP_NO_CACHE_DIR=1 \
5
  HF_HUB_ENABLE_HF_TRANSFER=1 \
 
6
  NUMBA_CACHE_DIR=/tmp/numba_cache \
7
- # optional: uncomment to fully disable FS caching
8
- # NUMBA_DISABLE_FILE_SYSTEM_CACHING=1
9
  OUTLINES_CACHE_DIR=/tmp/outlines_cache
 
10
 
11
  RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/*
12
  WORKDIR /app
@@ -14,11 +15,12 @@ WORKDIR /app
14
  COPY requirements.txt /app/
15
  RUN python3 -m pip install --upgrade pip && pip3 install -r requirements.txt
16
 
17
- # ensure cache dirs exist & writable
18
  RUN mkdir -p /tmp/numba_cache /tmp/outlines_cache && chmod -R 777 /tmp/numba_cache /tmp/outlines_cache
19
 
20
  COPY app.py /app/
21
 
 
22
  ENV PORT=7860
23
  EXPOSE 7860
24
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
2
+
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  PYTHONUNBUFFERED=1 \
5
  PIP_NO_CACHE_DIR=1 \
6
  HF_HUB_ENABLE_HF_TRANSFER=1 \
7
+ # Give numba/outlines a writable cache in Spaces runtime
8
  NUMBA_CACHE_DIR=/tmp/numba_cache \
 
 
9
  OUTLINES_CACHE_DIR=/tmp/outlines_cache
10
+ # If issues persist, add: NUMBA_DISABLE_FILE_SYSTEM_CACHING=1
11
 
12
  RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/*
13
  WORKDIR /app
 
15
  COPY requirements.txt /app/
16
  RUN python3 -m pip install --upgrade pip && pip3 install -r requirements.txt
17
 
18
+ # ensure caches exist & are writable in Spaces container
19
  RUN mkdir -p /tmp/numba_cache /tmp/outlines_cache && chmod -R 777 /tmp/numba_cache /tmp/outlines_cache
20
 
21
  COPY app.py /app/
22
 
23
+ # Spaces exposes the app on $PORT
24
  ENV PORT=7860
25
  EXPOSE 7860
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]