Canstralian commited on
Commit
013b4eb
·
verified ·
1 Parent(s): ad56392

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -5
Dockerfile CHANGED
@@ -1,22 +1,31 @@
1
  FROM ollama/ollama:latest
2
 
3
- RUN apt-get update && apt-get install curl -y
4
 
5
- # https://huggingface.co/docs/hub/spaces-sdks-docker-first-demo
6
  RUN useradd -m -u 1000 user
7
 
 
8
  USER user
9
 
 
10
  ENV HOME=/home/user \
11
- PATH=/home/user/.local/bin:$PATH \
12
  OLLAMA_HOST=0.0.0.0
13
 
 
14
  WORKDIR $HOME/app
15
 
 
16
  COPY --chown=user:user Modelfile $HOME/app/
17
 
18
- RUN curl -fsSL https://huggingface.co/gingdev/llama7b-ictu-v2/resolve/main/llama7b_q4_k_m.gguf?download=true -o llama.gguf
 
19
 
20
- RUN ollama serve & sleep 5 && ollama create llama -f Modelfile
 
 
 
21
 
 
22
  EXPOSE 11434
 
1
  FROM ollama/ollama:latest
2
 
3
+ RUN apt-get update && apt-get install -y curl
4
 
5
+ # Add a new user
6
  RUN useradd -m -u 1000 user
7
 
8
+ # Switch to non-root user
9
  USER user
10
 
11
+ # Set environment variables
12
  ENV HOME=/home/user \
13
+ PATH=/home/user/.local/bin:$PATH \
14
  OLLAMA_HOST=0.0.0.0
15
 
16
+ # Set the working directory
17
  WORKDIR $HOME/app
18
 
19
+ # Copy the Modelfile
20
  COPY --chown=user:user Modelfile $HOME/app/
21
 
22
+ # Download the llama.gguf file
23
+ RUN curl -fsSL -o llama.gguf "https://huggingface.co/gingdev/llama7b-ictu-v2/resolve/main/llama7b_q4_k_m.gguf?download=true"
24
 
25
+ # Ensure the server is ready before creating the model
26
+ RUN ollama serve & \
27
+ timeout 30 sh -c 'until curl -s http://127.0.0.1:11434/health; do sleep 1; done' && \
28
+ ollama create llama -f Modelfile
29
 
30
+ # Expose the port
31
  EXPOSE 11434