WilliamGazeley commited on
Commit
eac07bb
1 Parent(s): b1f79b2

Install ollama in docker image

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -3
  2. ollama_init.sh +13 -0
Dockerfile CHANGED
@@ -26,6 +26,11 @@ RUN apt-get update && \
26
  && apt-get clean \
27
  && rm -rf /var/lib/apt/lists/*
28
 
 
 
 
 
 
29
 
30
  RUN useradd -m -u 1000 user
31
  USER user
@@ -46,9 +51,6 @@ COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
46
  RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && \
47
  pip install flash-attn --no-build-isolation
48
 
49
- RUN curl -fsSL https://ollama.com/install.sh | sh
50
- RUN ollama pull ${OLLAMA_MODEL}
51
-
52
  COPY --chown=1000 src ${HOME}/app
53
 
54
  EXPOSE 8501
 
26
  && apt-get clean \
27
  && rm -rf /var/lib/apt/lists/*
28
 
29
+ RUN curl -fsSL https://ollama.com/install.sh | sh
30
+ ARG OLLAMA_MODEL
31
+ COPY ollama_init.sh .
32
+ RUN chmod +x ollama_init.sh
33
+ RUN ./ollama_init.sh ${OLLAMA_MODEL}
34
 
35
  RUN useradd -m -u 1000 user
36
  USER user
 
51
  RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && \
52
  pip install flash-attn --no-build-isolation
53
 
 
 
 
54
  COPY --chown=1000 src ${HOME}/app
55
 
56
  EXPOSE 8501
ollama_init.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ echo "Starting Ollama server..."
4
+ ollama serve &
5
+
6
+
7
+ echo "Waiting for Ollama server to be active..."
8
+ while [ "$(ollama list | grep 'NAME')" == "" ]; do
9
+ sleep 1
10
+ done
11
+
12
+
13
+ ollama pull $1