From 392bd56d4db153ca8ecc02459f9067655f37c457 Mon Sep 17 00:00:00 2001
From: Konrad Kolka <s180440@student.pg.edu.pl>
Date: Mon, 13 Jan 2025 20:08:15 +0100
Subject: [PATCH] pull nomic-embed-text llm model on ollama run

---
 Dockerfile         | 3 ---
 Dockerfile.ollama  | 9 +++++++++
 docker-compose.yml | 6 +++++-
 3 files changed, 14 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 Dockerfile
 create mode 100644 Dockerfile.ollama
 mode change 100644 => 100755 docker-compose.yml

diff --git a/Dockerfile b/Dockerfile
old mode 100644
new mode 100755
index ce635b9..3d427c0
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,13 +9,10 @@ RUN apt-get update && apt-get install -y \
     software-properties-common \
     && rm -rf /var/lib/apt/lists/*
 
-# Copy requirements first to leverage Docker cache
 COPY requirements.txt .
 
-# Install Python dependencies
 RUN pip install --no-cache-dir -r requirements.txt
 
-# Copy the rest of the application
 COPY . .
 
 # Expose the port Streamlit runs on
diff --git a/Dockerfile.ollama b/Dockerfile.ollama
new file mode 100644
index 0000000..00d9f00
--- /dev/null
+++ b/Dockerfile.ollama
@@ -0,0 +1,9 @@
+FROM ollama/ollama:latest
+
+RUN echo '#!/bin/sh\n\
+ollama serve &\n\
+sleep 5\n\
+ollama pull nomic-embed-text\n\
+wait' > /init.sh && chmod +x /init.sh
+
+CMD ["/init.sh"]
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
old mode 100644
new mode 100755
index 6ce1d47..34c2ecb
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,3 +1,5 @@
+# docker-compose.yml
+
 version: '3.8'
 
 services:
@@ -15,7 +17,9 @@ services:
       - ollama
 
   ollama:
-    image: ollama/ollama
+    build:
+      context: .
+      dockerfile: Dockerfile.ollama
     ports:
       - "11434:11434"
     volumes:
-- 
GitLab