Lincoln Gombedza commited on
Commit
f313b16
·
unverified ·
1 Parent(s): 69a9a47

Force CPU-only PyTorch to avoid 8GB CUDA libs on t3.small

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -2
Dockerfile CHANGED
@@ -7,7 +7,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7
 
8
  WORKDIR /app
9
 
10
- # Install Python deps first (cached layer)
 
 
 
 
 
 
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
@@ -20,7 +26,6 @@ COPY .streamlit/config.toml /app/.streamlit/config.toml
20
 
21
  EXPOSE 8501
22
 
23
- # Health check
24
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
25
 
26
  CMD ["streamlit", "run", "streamlit_app.py", \
 
7
 
8
  WORKDIR /app
9
 
10
+ # Install CPU-only PyTorch FIRST to prevent sentence-transformers
11
+ # pulling the massive CUDA-enabled build (~8GB → ~800MB)
12
+ RUN pip install --no-cache-dir \
13
+ torch==2.3.1+cpu torchvision==0.18.1+cpu \
14
+ --extra-index-url https://download.pytorch.org/whl/cpu
15
+
16
+ # Install remaining Python deps
17
  COPY requirements.txt .
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
 
26
 
27
  EXPOSE 8501
28
 
 
29
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
30
 
31
  CMD ["streamlit", "run", "streamlit_app.py", \