DeathDaDev commited on
Commit
0fa8221
1 Parent(s): 5b6bc41

feat: add gateway API for Ollama using Flask and docker-compose

Browse files
Files changed (5) hide show
  1. Dockerfile +2 -2
  2. Dockerfile.gateway +11 -0
  3. docker-compose.yml +14 -0
  4. gateway.py +0 -0
  5. requirements.txt +2 -0
Dockerfile CHANGED
@@ -34,5 +34,5 @@ User User
34
  # Expose port 11434 for Ollama and 5000 for the web server
35
  EXPOSE 11434 5000
36
 
37
- # Start Ollama server and the Flask web server
38
- cmd ollama serve & python3 app.py
 
34
  # Expose port 11434 for Ollama and 5000 for the web server
35
  EXPOSE 11434 5000
36
 
37
+ # Start Ollama server
38
+ cmd ollama serve
Dockerfile.gateway ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY ./requirements.txt /app/requirements.txt
6
+
7
+ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
8
+
9
+ COPY ./gateway.py /app/gateway.py
10
+
11
+ CMD ["python", "./gateway.py"]
docker-compose.yml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: "3.9"
2
+ services:
3
+ ollama:
4
+ build: .
5
+ ports:
6
+ - "11434:11434"
7
+ gateway:
8
+ build:
9
+ context: .
10
+ dockerfile: Dockerfile.gateway
11
+ ports:
12
+ - "5000:5000"
13
+ depends_on:
14
+ - ollama
gateway.py ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ flask
2
+ requests