ruslanmv commited on
Commit
7f1642b
1 Parent(s): ff822c8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -8
Dockerfile CHANGED
@@ -1,22 +1,35 @@
1
  FROM python:3.10-slim-buster
2
- RUN apt-get update && apt-get install curl -y
 
 
 
 
3
  RUN curl -fsSL https://ollama.com/install.sh | sh
 
4
  ENV OLLAMA_HOST=0.0.0.0
5
- # Create the directory and give appropriate permissions
6
  RUN mkdir -p /app/.ollama && chmod 777 /app/.ollama
 
 
 
 
 
7
  USER app
 
8
  WORKDIR /app/.ollama
9
- #Copy dossier de models
10
- #COPY --chown=app models /.ollama
11
- RUN chmod 777 /app/.ollama/models
 
12
  # Copy the entry point script
13
  COPY start.sh /app/start.sh
 
14
  RUN chmod +x /app/start.sh
15
- # Set the entry point script as the default command
16
- CMD ["/app/start.sh"]
17
- #ENV OLLAMA_MODELS="/home/app/.ollama/models"
18
  # Expose the server port
19
  EXPOSE 7860
 
 
 
20
 
21
 
22
  # Set the working directory
 
1
  FROM python:3.10-slim-buster
2
+ FROM python:3.10-slim-buster
3
+
4
+ # Install curl
5
+ RUN apt-get update && apt-get install -y curl
6
+ # Install ollama
7
  RUN curl -fsSL https://ollama.com/install.sh | sh
8
+ # Set environment variable
9
  ENV OLLAMA_HOST=0.0.0.0
10
+ # Create the directory and set permissions
11
  RUN mkdir -p /app/.ollama && chmod 777 /app/.ollama
12
+ # Create a new user and group
13
+ RUN groupadd -r app && useradd -r -g app app
14
+ # Change ownership of the directory
15
+ RUN chown -R app:app /app/.ollama
16
+ # Switch to the new user
17
  USER app
18
+ # Set working directory
19
  WORKDIR /app/.ollama
20
+ # Copy models directory (uncomment if you have a models directory to copy)
21
+ # COPY --chown=app:app models /app/.ollama
22
+ # Ensure the models directory exists before changing permissions
23
+ RUN mkdir -p /app/.ollama/models && chmod 777 /app/.ollama/models
24
  # Copy the entry point script
25
  COPY start.sh /app/start.sh
26
+ # Make the entry point script executable
27
  RUN chmod +x /app/start.sh
 
 
 
28
  # Expose the server port
29
  EXPOSE 7860
30
+ # Set the entry point script as the default command
31
+ CMD ["/app/start.sh"]
32
+ USER root
33
 
34
 
35
  # Set the working directory