Samizie commited on
Commit
76c8f92
·
verified ·
1 Parent(s): f0ab97d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -0
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ollama/ollama:latest
2
+
3
+ # Create a user and set up permissions
4
+ RUN useradd -ms /bin/bash ollama-user
5
+
6
+ # Set the home directory
7
+ ENV HOME=/home/ollama-user
8
+ WORKDIR $HOME
9
+
10
+ # Ensure the user has access to the directory
11
+ RUN mkdir -p $HOME/.ollama && chown -R ollama-user:ollama-user $HOME/.ollama
12
+
13
+ # Install netcat (nc) for checking server readiness
14
+ RUN apt-get update && apt-get install -y netcat
15
+
16
+ # Copy the entrypoint script before switching users
17
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
18
+
19
+ # Set permissions for the entrypoint script
20
+ RUN chmod +x /usr/local/bin/entrypoint.sh
21
+
22
+ # Switch to the non-root user
23
+ USER ollama-user
24
+
25
+ # Set Ollama to listen on all network interfaces
26
+ ENV OLLAMA_HOST=0.0.0.0:7860
27
+
28
+ # Expose the default port
29
+ EXPOSE 7860
30
+
31
+ # Use the custom entrypoint script
32
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]