redfernstech commited on
Commit
ff9773c
·
verified ·
1 Parent(s): 37941c9

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"]