Pavithiran commited on
Commit
7080a88
·
verified ·
1 Parent(s): 4b1732a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -3
Dockerfile CHANGED
@@ -1,13 +1,29 @@
 
1
  FROM ubuntu:22.04
2
 
 
 
 
 
 
 
 
3
  # Install dependencies
4
- RUN apt update && apt install -y curl git
 
 
5
 
6
  # Install Ollama
7
  RUN curl -fsSL https://ollama.com/install.sh | sh
8
 
9
- # Expose API port
 
 
 
 
 
 
10
  EXPOSE 11434
11
 
12
- # Run Ollama on start
13
  CMD ["ollama", "serve"]
 
1
+ # Use an official lightweight Ubuntu base image
2
  FROM ubuntu:22.04
3
 
4
+ # Set environment variables
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV OLLAMA_HOME=/home/user/.ollama
7
+
8
+ # Create a non-root user to avoid permission issues
9
+ RUN useradd -m -s /bin/bash user
10
+
11
  # Install dependencies
12
+ RUN apt update && apt install -y \
13
+ curl git && \
14
+ rm -rf /var/lib/apt/lists/*
15
 
16
  # Install Ollama
17
  RUN curl -fsSL https://ollama.com/install.sh | sh
18
 
19
+ # Ensure the Ollama home directory is writable
20
+ RUN mkdir -p $OLLAMA_HOME && chown -R user:user $OLLAMA_HOME
21
+
22
+ # Switch to non-root user
23
+ USER user
24
+
25
+ # Expose Ollama API port
26
  EXPOSE 11434
27
 
28
+ # Start Ollama server
29
  CMD ["ollama", "serve"]