Nielo47 commited on
Commit
7f630eb
·
verified ·
1 Parent(s): 35c8649

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -11
Dockerfile CHANGED
@@ -1,29 +1,33 @@
1
  FROM python:3.10-slim
2
 
3
- # 1) Install system deps + Ollama CLI
4
  RUN apt-get update \
5
- && apt-get install -y curl \
6
- && curl -fsSL https://ollama.com/install.sh | sh \
7
- && apt-get clean && rm -rf /var/lib/apt/lists/*
8
 
9
- # 2) Create unprivileged user
10
  RUN useradd -m -u 1000 user
11
  USER user
12
  ENV HOME=/home/user \
13
  PATH="/home/user/.local/bin:$PATH"
 
14
  WORKDIR $HOME/app
15
 
16
- # 3) Install Python libs
17
  COPY --chown=user:user requirements.txt .
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
- # 4) Pre-pull embeddings & generation models at build time
21
- RUN ollama pull nomic-embed-text \
22
- && ollama pull gemma3:1b
 
 
 
23
 
24
- # 5) Copy app code & entrypoint
25
  COPY --chown=user:user . ./
26
  RUN chmod +x start.sh
27
 
28
- # 6) Launch
29
  CMD ["./start.sh"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 1) System deps & Ollama installation
4
  RUN apt-get update \
5
+ && apt-get install -y curl \
6
+ && curl -fsSL https://ollama.com/install.sh | sh \
7
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
8
 
9
+ # 2) Create non‑root user
10
  RUN useradd -m -u 1000 user
11
  USER user
12
  ENV HOME=/home/user \
13
  PATH="/home/user/.local/bin:$PATH"
14
+
15
  WORKDIR $HOME/app
16
 
17
+ # 3) Install Python requirements
18
  COPY --chown=user:user requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # 4) Prepull Ollama models by briefly running the daemon in-build
22
+ RUN ollama serve & \
23
+ sleep 15 && \
24
+ ollama pull nomic-embed-text && \ # ~274 MB download :contentReference[oaicite:0]{index=0}
25
+ ollama pull gemma3:1b && \ # ~815 MB download :contentReference[oaicite:1]{index=1}
26
+ pkill ollama
27
 
28
+ # 5) Copy app sources & startup script
29
  COPY --chown=user:user . ./
30
  RUN chmod +x start.sh
31
 
32
+ # 6) Launch entrypoint
33
  CMD ["./start.sh"]