SoufianeDahimi commited on
Commit
1bf8cee
·
verified ·
1 Parent(s): ed30e83

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -6
Dockerfile CHANGED
@@ -11,6 +11,10 @@ RUN curl -fsSL https://ollama.com/install.sh | sh
11
  # Set working directory
12
  WORKDIR /code
13
 
 
 
 
 
14
  # Copy requirements and install Python dependencies
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
@@ -18,11 +22,20 @@ RUN pip install --no-cache-dir -r requirements.txt
18
  # Copy application files
19
  COPY . .
20
 
21
- # Create directory for Ollama
22
- RUN mkdir -p /root/.ollama
23
 
24
- # Expose port
25
  EXPOSE 7860
26
-
27
- # Start Ollama service and then the app
28
- CMD ollama serve & sleep 10 && ollama pull llm_hub/child_trauma_gemma && python app.py
 
 
 
 
 
 
 
 
 
 
11
  # Set working directory
12
  WORKDIR /code
13
 
14
+ # Set Ollama environment variables
15
+ ENV OLLAMA_HOST=0.0.0.0:11434
16
+ ENV OLLAMA_HOME=/code/.ollama
17
+
18
  # Copy requirements and install Python dependencies
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir -r requirements.txt
 
22
  # Copy application files
23
  COPY . .
24
 
25
+ # Create Ollama directories with proper permissions
26
+ RUN mkdir -p /code/.ollama && chmod 755 /code/.ollama
27
 
28
+ # Expose ports
29
  EXPOSE 7860
30
+ EXPOSE 11434
31
+
32
+ # Create startup script
33
+ RUN echo '#!/bin/bash\n\
34
+ export OLLAMA_HOME=/code/.ollama\n\
35
+ export OLLAMA_HOST=0.0.0.0:11434\n\
36
+ ollama serve &\n\
37
+ sleep 15\n\
38
+ ollama pull llm_hub/child_trauma_gemma\n\
39
+ python app.py' > /code/start.sh && chmod +x /code/start.sh
40
+
41
+ CMD ["/code/start.sh"]