Skip to content

Commit 7028ff8

Browse files
committed
deployment works
1 parent 1ce0ef8 commit 7028ff8

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

samples/ollama/app/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
FROM ubuntu:22.04
1+
FROM debian:bookworm-slim
22

33
# install curl
44
RUN apt-get update && apt-get install -y curl && apt-get clean
55

6-
# create ollama user and group
7-
RUN groupadd -r ollama && useradd -r -g ollama ollama
6+
# Define build-time arguments with default values
7+
ARG OLLAMA_HOST=0.0.0.0:8000
8+
ARG OLLAMA_MODELS=/usr/share/ollama/.ollama/models
9+
10+
# Use the build-time arguments to set environment variables
11+
ENV OLLAMA_HOST=${OLLAMA_HOST}
12+
ENV OLLAMA_MODELS=${OLLAMA_MODELS}
813

914
RUN curl -fsSL https://ollama.com/install.sh | sh
1015

11-
COPY ./run /run
16+
WORKDIR /app
1217

13-
USER ollama
18+
COPY ./run.sh ./run.sh
1419

15-
CMD ["/run"]
20+
CMD ["./run.sh"]

samples/ollama/app/run

Lines changed: 0 additions & 4 deletions
This file was deleted.

samples/ollama/app/run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
nohup ollama serve > ollama.log 2>&1 &
4+
time curl --retry 5 --retry-connrefused --retry-delay 0 -sf http://localhost:8000
5+
6+
ollama pull llama3.2:1b
7+
8+
# tail the log file infinitely
9+
tail -f ollama.log

samples/ollama/compose.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Sample compose file. #REMOVE_ME_AFTER_EDITING
2-
31
services:
42
app:
53
# uncomment to add your own domain
@@ -8,10 +6,15 @@ services:
86
context: ./app
97
dockerfile: Dockerfile
108
ports:
11-
- target: 3000
12-
published: 3000
9+
- target: 8000
10+
published: 8000
1311
mode: ingress
12+
deploy:
13+
resources:
14+
limits:
15+
cpus: '2'
16+
memory: 4G
1417
healthcheck:
1518
# wget or curl required for healthchecks on services with a published port
1619
# this gets parsed by Defang and provided to the load balancers as well
17-
test: [ "CMD", "curl", "-s", "http://localhost:3000/" ]
20+
test: [ "CMD", "curl", "-s", "http://localhost:8000/" ]

0 commit comments

Comments
 (0)