ruslanmv commited on
Commit
a131c07
1 Parent(s): cbcc785
Files changed (2) hide show
  1. Dockerfile +7 -11
  2. ollama_start.sh +10 -0
Dockerfile CHANGED
@@ -1,18 +1,16 @@
1
  FROM python:3.10-slim-buster
2
- RUN curl https://ollama.ai/install.sh | sh
3
- # Create the directory and give appropriate permissions
4
- RUN mkdir -p /.ollama && chmod 777 /.ollama
5
- # Command to run the application
6
- CMD ollama serve
7
- # Expose the server port
8
- EXPOSE 7860
9
 
10
  # Set the working directory
11
  WORKDIR /app
12
-
13
  # Copy requirements file
14
  COPY requirements.txt requirements.txt
15
-
16
  # Create a virtual environment
17
  RUN python -m venv venv
18
 
@@ -48,12 +46,10 @@ COPY . .
48
  # Set proper permissions for the translations directory
49
  RUN chmod -R 777 translations
50
 
51
- RUN /usr/local/bin/ollama pull llama3
52
 
53
  # Copy the init script
54
  COPY init.sh /app/init.sh
55
  RUN chmod +x /app/init.sh
56
 
57
-
58
  # Define the command to run the init script
59
  CMD ["/bin/bash", "/app/init.sh"]
 
1
  FROM python:3.10-slim-buster
2
+ # Set up the working directory
3
+ WORKDIR /
4
+ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
5
+ # Copy a custom entrypoint script into the container
6
+ COPY ollama_start.sh /
7
+ RUN chmod +x /ollama_start.sh
8
+ CMD ["ollama_start.sh"]
9
 
10
  # Set the working directory
11
  WORKDIR /app
 
12
  # Copy requirements file
13
  COPY requirements.txt requirements.txt
 
14
  # Create a virtual environment
15
  RUN python -m venv venv
16
 
 
46
  # Set proper permissions for the translations directory
47
  RUN chmod -R 777 translations
48
 
 
49
 
50
  # Copy the init script
51
  COPY init.sh /app/init.sh
52
  RUN chmod +x /app/init.sh
53
 
 
54
  # Define the command to run the init script
55
  CMD ["/bin/bash", "/app/init.sh"]
ollama_start.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Execute the start.sh script from the base image (assuming it's in /path/to/start.sh)
4
+ ./start.sh &
5
+
6
+ # Run additional commands from your Dockerfile
7
+ (curl -fsSL https://ollama.com/install.sh | sh && ollama serve > ollama.log 2>&1) &
8
+
9
+ # Keep the container running by running a dummy command
10
+ ollama serve