Subham9126 commited on
Commit
a773709
·
verified ·
1 Parent(s): d22ff73

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -20
Dockerfile CHANGED
@@ -1,26 +1,26 @@
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-openbsd
13
 
14
-
15
- # Copy the entrypoint script
16
- COPY entrypoint.sh /usr/local/bin/entrypoint.sh
17
- RUN chmod +x /usr/local/bin/entrypoint.sh
18
-
19
- # Switch to the non-root user
20
- USER ollama-user
21
-
22
- # Set Ollama to listen on the correct port
23
  ENV OLLAMA_HOST=0.0.0.0:7860
 
 
 
 
 
 
 
 
 
 
 
24
  EXPOSE 7860
25
-
26
- ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 
 
1
+ FROM ollama/ollama
2
 
3
+ # 1. User & Permissions setup
 
 
 
4
 
5
+ RUN mkdir -p /home/user/.ollama
6
+ RUN chown -R 1000:1000 /home/user
7
+ ENV HOME=/home/user
8
 
9
+ # 2. Network Config
 
10
 
 
 
 
 
 
 
 
 
 
11
  ENV OLLAMA_HOST=0.0.0.0:7860
12
+ ENV OLLAMA_ORIGINS=*
13
+
14
+ # 3. CRITICAL OPTIMIZATIONS for 2-3 Users
15
+ # Parallel: Allows 2 requests to run at the exact same time.
16
+ ENV OLLAMA_NUM_PARALLEL=2
17
+ # Keep Alive: Never unload the model from RAM (keeps it ready instantly).
18
+ ENV OLLAMA_KEEP_ALIVE=-1
19
+ # Max Models: Force Ollama to focus only on this one model to save RAM.
20
+ ENV OLLAMA_MAX_LOADED_MODELS=1
21
+ # 4. Switch to user
22
+ USER 1000
23
  EXPOSE 7860
24
+ # 5. Start, optimize, and keep running
25
+ # We use 'qwen3:0.6b' (or the specific tag you need)
26
+ ENTRYPOINT ["/bin/sh", "-c", "ollama serve & sleep 10 && ollama pull qwen3.5:0.8b && wait"]