ruslanmv commited on
Commit
35b2345
1 Parent(s): 7f1642b
Files changed (2) hide show
  1. Dockerfile +18 -32
  2. script.sh +7 -0
Dockerfile CHANGED
@@ -1,37 +1,23 @@
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
36
  WORKDIR /app
37
  # Copy requirements file
 
1
+ #################### Layer 1
2
+ # Using the ollama docker image as a base, so we get nvidia support for free,
3
+ # install python3 with venv and pip.
4
+ #
5
+ FROM ollama/ollama:latest as just-add-python
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ RUN apt update && \
8
+ apt install -qy \
9
+ git curl wget \
10
+ python3 python-is-python3 python3-venv python3-pip \
11
+ && \
12
+ # Shrink the layer's footprint \
13
+ apt autoclean && \
14
+ rm -rf /var/lib/apt/lists/*
15
 
16
+ COPY ./script.sh /tmp/script.sh
17
+ WORKDIR /tmp
18
+ RUN chmod +x script.sh \
19
+ && ./script.sh
20
+ EXPOSE 11434
21
  # Set the working directory
22
  WORKDIR /app
23
  # Copy requirements file
script.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+
2
+ #!/usr/bin/env bash
3
+
4
+ ollama serve &
5
+ ollama list
6
+ ollama pull nomic-embed-text
7
+ ollama pull llama3:8b