NitinBot001 commited on
Commit
c664b90
·
verified ·
1 Parent(s): 0b74cd4

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Ubuntu as base image
2
+ FROM ubuntu:22.04
3
+
4
+ # Set environment variables
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV OLLAMA_HOST=0.0.0.0
7
+
8
+ # Update system and install dependencies
9
+ RUN apt-get update && apt-get install -y \
10
+ curl \
11
+ ca-certificates \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Install Ollama
15
+ RUN curl -fsSL https://ollama.com/install.sh | sh
16
+
17
+ # Create a non-root user for running Ollama
18
+ RUN useradd -m -s /bin/bash ollama
19
+
20
+ # Create directory for Ollama data
21
+ RUN mkdir -p /home/ollama/.ollama && chown -R ollama:ollama /home/ollama/.ollama
22
+
23
+ # Switch to ollama user
24
+ USER ollama
25
+ WORKDIR /home/ollama
26
+
27
+ # Expose the default Ollama port
28
+ EXPOSE 11434
29
+
30
+ # Health check
31
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
32
+ CMD curl -f http://localhost:11434/api/tags || exit 1
33
+
34
+ # Start Ollama server
35
+ CMD ["ollama", "serve"]