NeelTA commited on
Commit
e511d09
·
1 Parent(s): 39bf074
Files changed (1) hide show
  1. Dockerfile +22 -10
Dockerfile CHANGED
@@ -3,16 +3,28 @@
3
 
4
  FROM python:3.9
5
 
6
- # Install Ollama FIRST while still running as root (critical!)
7
- RUN wget -qO- https://ollama.com/install.sh | sh
8
- # Start Ollama, pull model, then stop
9
- RUN ollama serve & \
10
- OLLAMA_PID=$! && \
11
- sleep 5 && \
12
- ollama pull gpt-oss:20b && \
13
- kill $OLLAMA_PID
14
-
15
- # Now create and switch to non-root user
 
 
 
 
 
 
 
 
 
 
 
 
16
  RUN useradd -m -u 1000 user
17
  USER user
18
  ENV PATH="/home/user/.local/bin:$PATH"
 
3
 
4
  FROM python:3.9
5
 
6
+ # Install Ollama with retry logic
7
+ RUN apt-get update && apt-get install -y wget curl && \
8
+ wget -qO- https://ollama.com/install.sh | sh || \
9
+ (echo "First install failed, retrying..." && \
10
+ sleep 5 && \
11
+ wget -qO- https://ollama.com/install.sh | sh)
12
+
13
+ # Start Ollama with retries
14
+ RUN (ollama serve & \
15
+ OLLAMA_PID=$! && \
16
+ sleep 10 && \
17
+ ollama pull gpt-oss:20b && \
18
+ kill $OLLAMA_PID) || \
19
+ (echo "First pull failed, retrying..." && \
20
+ sleep 10 && \
21
+ ollama serve & \
22
+ OLLAMA_PID=$! && \
23
+ sleep 15 && \
24
+ ollama pull gpt-oss:20b && \
25
+ kill $OLLAMA_PID)
26
+
27
+ # Create user
28
  RUN useradd -m -u 1000 user
29
  USER user
30
  ENV PATH="/home/user/.local/bin:$PATH"