redfernstech commited on
Commit
a8fe4dc
·
verified ·
1 Parent(s): 47a3182

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -23
Dockerfile CHANGED
@@ -1,36 +1,18 @@
1
- FROM ubuntu:22.04
2
 
3
- # Set the working directory in the container
4
  WORKDIR /app
5
 
6
- # Install system dependencies and Python
7
- RUN apt-get update && apt-get install -y \
8
- python3 \
9
- python3-pip \
10
- curl \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Set Python3 as the default
14
- RUN ln -s /usr/bin/python3 /usr/bin/python
15
 
16
  # Install Ollama
17
  RUN curl -fsSL https://ollama.com/install.sh | bash
18
-
19
- # Ensure Ollama is in the system path
20
  ENV PATH="/root/.ollama/bin:$PATH"
21
 
22
- # Pre-download the Llama3 model to avoid downloading it at runtime
23
- RUN ollama serve & sleep 5 && ollama pull mannix/defog-llama3-sqlcoder-8b
24
-
25
- # Copy the requirements file and install dependencies
26
  COPY requirements.txt ./
27
  RUN pip install --no-cache-dir -r requirements.txt
28
-
29
- # Copy the application files
30
  COPY . .
31
 
32
- # Expose the FastAPI default port
33
  EXPOSE 8000
34
-
35
- # Start Ollama and FastAPI
36
- CMD ["sh", "-c", "ollama serve & uvicorn main:app --host 0.0.0.0 --port 8000"]
 
1
+ FROM python:3.11-slim as base
2
 
 
3
  WORKDIR /app
4
 
5
+ # Install system tools
6
+ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
7
 
8
  # Install Ollama
9
  RUN curl -fsSL https://ollama.com/install.sh | bash
 
 
10
  ENV PATH="/root/.ollama/bin:$PATH"
11
 
12
+ COPY models /root/.ollama/models/
 
 
 
13
  COPY requirements.txt ./
14
  RUN pip install --no-cache-dir -r requirements.txt
 
 
15
  COPY . .
16
 
 
17
  EXPOSE 8000
18
+ CMD ["sh", "-c", "ollama serve & uvicorn app.main:app --host 0.0.0.0 --port 8000"]