avoid installing librairies for gpu

#6
by RCaz - opened
Files changed (2) hide show
  1. dockerfile +14 -21
  2. requirements.txt +10 -2
dockerfile CHANGED
@@ -1,25 +1,18 @@
1
- FROM mcr.microsoft.com/devcontainers/python:1-3.11-bookworm
2
 
3
- WORKDIR /workspace
 
 
 
 
 
4
 
5
- COPY packages.txt* requirements.txt* ./
6
 
7
- RUN if [ -f packages.txt ]; then \
8
- apt-get update && \
9
- apt-get upgrade -y && \
10
- xargs apt-get install -y < packages.txt && \
11
- rm -rf /var/lib/apt/lists/*; \
12
- fi
13
 
14
- RUN if [ -f requirements.txt ]; then \
15
- pip3 install --user -r requirements.txt; \
16
- fi && \
17
- pip3 install --user streamlit
18
-
19
- COPY . .
20
-
21
- EXPOSE 8501
22
-
23
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
24
-
25
- CMD ["streamlit", "run", "app/Welcome.py", "--server.enableCORS", "false", "--server.enableXsrfProtection", "false", "--server.port", "8501", "--server.address", "0.0.0.0"]
 
1
+ FROM python:3.12-slim AS builder
2
 
3
+ # mimick container built for gradio
4
+ RUN apt-get update && apt-get install -y \
5
+ git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1 curl \
6
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
7
+ && apt-get install -y nodejs \
8
+ && rm -rf /var/lib/apt/lists/*
9
 
10
+ WORKDIR /app
11
 
12
+ # install without gpu
13
+ RUN pip install --no-cache-dir -U pip
14
+ COPY requirements.txt .
15
+ RUN --mount=type=cache,target=/root/.cache/pip \
16
+ pip install --no-cache-dir -r requirements.txt
 
17
 
18
+ CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,10 +1,18 @@
 
 
 
 
 
 
 
 
1
  langchain-core
2
  langchain
3
  langchain-community
4
  langchain-openai
5
  langchain-huggingface
 
6
  gradio
7
- sentence-transformers
8
- faiss-cpu
9
  python-dotenv
10
  azure-storage-blob
 
1
+ --extra-index-url https://download.pytorch.org/whl/cpu
2
+ torch
3
+ torchvision
4
+ torchaudio
5
+
6
+ sentence-transformers
7
+ faiss-cpu
8
+
9
  langchain-core
10
  langchain
11
  langchain-community
12
  langchain-openai
13
  langchain-huggingface
14
+
15
  gradio
16
+
 
17
  python-dotenv
18
  azure-storage-blob