ChandimaPrabath commited on
Commit
0781a6b
·
verified ·
1 Parent(s): 57c485f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -19
Dockerfile CHANGED
@@ -1,36 +1,27 @@
1
  # Use the latest version of the ollama image
2
  FROM ollama/ollama:latest
3
 
4
- # Switch to root to perform admin tasks
5
- USER root
6
-
7
- # Install curl
8
  RUN apt-get update && \
9
  apt-get install -y curl && \
10
  apt-get clean && \
11
- rm -rf /var/lib/apt/lists/*
12
-
13
- # Create a dedicated directory for our app.
14
- # The user that runs ollama is UID 1000. We will use that.
15
- RUN mkdir -p /app
16
 
17
  # Set environment variables
18
- ENV HOME=/app \
19
- PATH=/app/.local/bin:$PATH \
20
  OLLAMA_HOST=0.0.0.0 \
21
  OLLAMA_ORIGINS=*
22
 
23
- # Set the working directory
24
- WORKDIR /app
 
25
 
26
- # Copy the entrypoint script and set ownership using the UID and GID
27
- COPY --chown=1000:1000 entrypoint.sh .
28
 
29
  # Make the entrypoint script executable
30
- RUN chmod +x entrypoint.sh
31
-
32
- # Switch to the non-root user by its UID
33
- USER 1000
34
 
35
  # Expose the port for the Ollama server
36
  EXPOSE 11434
 
1
  # Use the latest version of the ollama image
2
  FROM ollama/ollama:latest
3
 
4
+ # Install curl and create a user with a non-conflicting UID
 
 
 
5
  RUN apt-get update && \
6
  apt-get install -y curl && \
7
  apt-get clean && \
8
+ rm -rf /var/lib/apt/lists/* && \
9
+ useradd -m -u 1001 user # CHANGED: UID is now 1001
 
 
 
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
  OLLAMA_ORIGINS=*
16
 
17
+ # Set the working directory and switch to the user
18
+ WORKDIR $HOME/app
19
+ USER user
20
 
21
+ COPY --chown=user:user entrypoint.sh $HOME/app/
 
22
 
23
  # Make the entrypoint script executable
24
+ RUN chmod +x $HOME/app/entrypoint.sh
 
 
 
25
 
26
  # Expose the port for the Ollama server
27
  EXPOSE 11434