Subham9126 commited on
Commit
2b26d8e
·
verified ·
1 Parent(s): 070df7c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -17
Dockerfile CHANGED
@@ -1,23 +1,25 @@
1
- FROM ubuntu:22.04
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive
4
- ENV OLLAMA_HOST=0.0.0.0:7860
 
 
 
 
 
5
 
6
- # Install dependencies (including zstd the missing piece)
7
- RUN apt-get update && \
8
- apt-get install -y curl ca-certificates zstd && \
9
- rm -rf /var/lib/apt/lists/*
10
 
11
- # Install Ollama (official script)
12
- RUN curl -fsSL https://ollama.com/install.sh | sh
 
13
 
 
 
 
 
 
14
  EXPOSE 7860
15
 
16
- CMD bash -c "\
17
- ollama serve & \
18
- until curl -s http://localhost:7860 > /dev/null; do \
19
- sleep 1; \
20
- done; \
21
- ollama pull qwen3.5:0.8b; \
22
- wait"
23
-
 
1
+ FROM ollama/ollama:latest
2
 
3
+ # Create a user and set up permissions
4
+ RUN useradd -ms /bin/bash ollama-user
5
+ ENV HOME=/home/ollama-user
6
+ WORKDIR $HOME
7
+
8
+ # Ensure the user has access to the directory
9
+ RUN mkdir -p $HOME/.ollama && chown -R ollama-user:ollama-user $HOME/.ollama
10
 
11
+ # Install netcat (nc) for checking server readiness
12
+ RUN apt-get update && apt-get install -y netcat
 
 
13
 
14
+ # Copy the entrypoint script
15
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
16
+ RUN chmod +x /usr/local/bin/entrypoint.sh
17
 
18
+ # Switch to the non-root user
19
+ USER ollama-user
20
+
21
+ # Set Ollama to listen on the correct port
22
+ ENV OLLAMA_HOST=0.0.0.0:7860
23
  EXPOSE 7860
24
 
25
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]