Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
feat: Adds docker with Ollama support
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Dec 11, 2023
1 parent faf5ce9 commit b91a552
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions docker-compose.ollama.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
version: '3.7'

services:
backend:
build: .
command: uvicorn app.main:app --reload --host 0.0.0.0 --port 8050 --proxy-headers
volumes:
- ./src/:/app/
ports:
- "8050:8050"
environment:
- SUPERADMIN_GH_PAT=${SUPERADMIN_GH_PAT}
- SUPERADMIN_PWD=${SUPERADMIN_PWD}
- GH_OAUTH_ID=${GH_OAUTH_ID}
- GH_OAUTH_SECRET=${GH_OAUTH_SECRET}
- POSTGRES_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- SECRET_KEY=${SECRET_KEY}
- SENTRY_DSN=${SENTRY_DSN}
- SERVER_NAME=${SERVER_NAME}
- POSTHOG_KEY=${POSTHOG_KEY}
- SLACK_API_TOKEN=${SLACK_API_TOKEN}
- SLACK_CHANNEL=${SLACK_CHANNEL}
- OLLAMA_ENDPOINT=http://ollama:11434
- OLLAMA_MODEL=${OLLAMA_MODEL}
- SUPPORT_EMAIL=${SUPPORT_EMAIL}
- DEBUG=true
depends_on:
db:
condition: service_healthy
ollama:
condition: service_healthy

ollama:
image: ollama/ollama:latest
command: serve && ollama pull ${OLLAMA_MODEL}
volumes:
- "$HOME/.ollama:/root/.ollama"
expose:
- 11434
healthcheck:
test: ["CMD-SHELL", "ollama list | grep -q '${OLLAMA_MODEL}'"]
interval: 10s
timeout: 3s
retries: 3
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

# ollama-webui:
# image: ghcr.io/ollama-webui/ollama-webui:main
# container_name: ollama-webui
# depends_on:
# - ollama
# # Uncomment below for WIP: Auth support
# # - ollama-webui-db
# ports:
# - 3000:8080
# environment:
# - "OLLAMA_API_BASE_URL=http://ollama:11434/api"
# # Uncomment below for WIP: Auth support
# # - "WEBUI_AUTH=TRUE"
# # - "WEBUI_DB_URL=mongodb://root:example@ollama-webui-db:27017/"
# # - "WEBUI_JWT_SECRET_KEY=SECRET_KEY"
# # extra_hosts:
# # - host.docker.internal:host-gateway
# # restart: unless-stopped

db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
expose:
- 5432
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'"]
interval: 10s
timeout: 3s
retries: 3

volumes:
postgres_data:
ollama:

0 comments on commit b91a552

Please sign in to comment.