-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8a17c7
commit ad73310
Showing
6 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM golang:1.22 as build | ||
|
||
ENV USER=appuser \ | ||
UID=1000 \ | ||
GO111MODULE=on \ | ||
CGO_ENABLED=1 | ||
|
||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/tmp" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
"${USER}" | ||
|
||
WORKDIR /src | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN go build \ | ||
-o /bin/jenn-ai \ | ||
-ldflags "-w -s -linkmode external -extldflags "-static"" \ | ||
. && \ | ||
chown appuser:appuser /bin/jenn-ai | ||
|
||
FROM scratch | ||
|
||
# Needed for ssl requirements | ||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Used for the unprivileged user | ||
COPY --from=build /etc/passwd /etc/passwd | ||
COPY --from=build /etc/group /etc/group | ||
|
||
WORKDIR /app | ||
COPY --from=build /bin/jenn-ai /bin/jenn-ai | ||
COPY --from=build /src/templates /app/templates | ||
USER appuser:appuser | ||
ENTRYPOINT ["/bin/jenn-ai", "server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This Makefile is used to easy the commands used | ||
|
||
deps: | ||
@go install github.com/air-verse/air@latest | ||
|
||
local_dev: | ||
@air | ||
|
||
local: | ||
@go install | ||
@jenn-ai server | ||
|
||
# default value is set to docker-compose.yaml | ||
# if you have a gpu, you will want to run: | ||
# | ||
# make <command> COMPOSE_FILE=docker-compose-gpu.yaml | ||
COMPOSE_FILE ?= docker-compose.yaml | ||
|
||
build_dev: $(COMPOSE_FILE) | ||
@docker-compose -f $< build jenn_ai_dev | ||
|
||
up_dev: $(COMPOSE_FILE) | ||
@docker-compose -f $< up -d jenn_ai_dev | ||
|
||
build: $(COMPOSE_FILE) | ||
@docker-compose -f $< build jenn_ai | ||
|
||
up: $(COMPOSE_FILE) | ||
@docker-compose -f $< up -d jenn_ai | ||
|
||
down: $(COMPOSE_FILE) | ||
@docker-compose -f $< down | ||
|
||
# exec is used to enter the ollama container to install models | ||
exec: | ||
@docker exec -it ollama bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM golang:1.22 | ||
|
||
ENV USER=appuser \ | ||
UID=1000 \ | ||
GO111MODULE=on \ | ||
CGO_ENABLED=1 | ||
|
||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/tmp" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
"${USER}" | ||
|
||
WORKDIR /app | ||
|
||
RUN go install github.com/air-verse/air@latest | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download && \ | ||
mkdir -p /.cache/go-build && \ | ||
chown -R appuser:appuser /.cache | ||
|
||
USER appuser:appuser | ||
CMD ["air", "-c", ".air.toml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
version: "3.7" | ||
services: | ||
jenn_ai_dev: | ||
container_name: jenn_ai_dev | ||
build: | ||
context: . | ||
dockerfile: dev.Dockerfile | ||
user: 1000:1000 | ||
environment: | ||
- OLLAMA_HOST=ollama:11434 | ||
depends_on: | ||
- ollama | ||
ports: | ||
- 3000:31000 | ||
networks: | ||
- ollama | ||
volumes: | ||
- ./:/app | ||
# # mount aws credentials for bedrock | ||
# - ~/.aws:/tmp/.aws | ||
|
||
jenn_ai: | ||
container_name: jenn_ai | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
user: 1000:1000 | ||
environment: | ||
- OLLAMA_HOST=ollama:11434 | ||
depends_on: | ||
- ollama | ||
ports: | ||
- 31000:31000 | ||
networks: | ||
- ollama | ||
# volumes: | ||
# # mount aws credentials for bedrock | ||
# - ~/.aws:/tmp/.aws | ||
|
||
ollama: | ||
container_name: ollama | ||
image: ollama/ollama | ||
healthcheck: | ||
test: ollama --version || exit 1 | ||
command: serve | ||
networks: | ||
- ollama | ||
volumes: | ||
- ollama:/root/.ollama | ||
# only used on devices with gpu, otherwise you can comment or delete | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
device_ids: ['all'] | ||
capabilities: [gpu] | ||
|
||
volumes: | ||
ollama: | ||
|
||
networks: | ||
ollama: | ||
name: ollama_default | ||
external: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
version: "3.7" | ||
services: | ||
jenn_ai_dev: | ||
container_name: jenn_ai_dev | ||
build: | ||
context: . | ||
dockerfile: dev.Dockerfile | ||
user: 1000:1000 | ||
environment: | ||
- OLLAMA_HOST=ollama:11434 | ||
depends_on: | ||
- ollama | ||
ports: | ||
- 3000:31000 | ||
networks: | ||
- ollama | ||
volumes: | ||
- ./:/app | ||
# # mount aws credentials for bedrock | ||
# - ~/.aws:/tmp/.aws | ||
|
||
jenn_ai: | ||
container_name: jenn_ai | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
user: 1000:1000 | ||
environment: | ||
- OLLAMA_HOST=ollama:11434 | ||
depends_on: | ||
- ollama | ||
ports: | ||
- 31000:31000 | ||
networks: | ||
- ollama | ||
# volumes: | ||
# # mount aws credentials for bedrock | ||
# - ~/.aws:/tmp/.aws | ||
|
||
ollama: | ||
container_name: ollama | ||
image: ollama/ollama | ||
healthcheck: | ||
test: ollama --version || exit 1 | ||
command: serve | ||
networks: | ||
- ollama | ||
volumes: | ||
- ollama:/root/.ollama | ||
|
||
volumes: | ||
ollama: | ||
|
||
networks: | ||
ollama: | ||
name: ollama_default | ||
external: false |