Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates #148

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DOCKER_PREFIX=openui
CONTAINER_NAME=openui

# Ports
BACKEND_OPENUI_PORT=9000
OLLAMA_OPENUI_PORT=11434
OPENAPI_KEY=YOUR_OPENAPI_KEY
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
nohup.out
nohup.out
.env
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.PHONY: network remove-network list-network start stop destroy volume build list link exe composer bun bun-upgrade bun-update

COMPOSE =sudo docker-compose
DOCKER = sudo docker
# Load .env file
DOCKER_PREFIX:= $(shell grep -E '^DOCKER_PREFIX' .env | cut -d '=' -f 2)
CONTAINER_NAME:= $(shell grep -E '^CONTAINER_NAME' .env | cut -d '=' -f 2)
BACKEND_OPENUI_PORT:= $(shell grep -E '^BACKEND_OPENUI_PORT' .env | cut -d '=' -f 2)
OLLAMA_OPENUI_PORT:= $(shell grep -E '^OLLAMA_OPENUI_PORT' .env | cut -d '=' -f 2)

# /*
# |--------------------------------------------------------------------------
# | docker cmds
# |--------------------------------------------------------------------------
# */
start:
@$(COMPOSE) up -d

stop:
@$(COMPOSE) down

destroy:
@$(COMPOSE) rm -v -s -f

volume:
@$(DOCKER) volume ls

build:
@$(COMPOSE) build

list:
@$(COMPOSE) ps -a

prune:
@$(DOCKER) system prune -a

# /*
# |--------------------------------------------------------------------------
# | Utility cmds
# |--------------------------------------------------------------------------
# */
link:
@echo "Creating URLs for services with '$(DOCKER_PREFIX)_' prefix..."
@SERVER_IP=$$(hostname -I | cut -d' ' -f1); \
echo "http://$$SERVER_IP:$(BACKEND_OPENUI_PORT)"; \
echo "http://$$SERVER_IP:$(OLLAMA_OPENUI_PORT)";


exe-backend:
@$(DOCKER) exec -it ${DOCKER_PREFIX}_${CONTAINER_NAME}_OPENUI_BACKEND /bin/bash

exe-ollama:
@$(DOCKER) exec -it ${DOCKER_PREFIX}_${CONTAINER_NAME}_OPENUI_BACKEND /bin/bash

# Commands and their descriptions
help:
@echo "Available commands:"
@echo " make start - Starts the services"
@echo " make stop - Stops the services"
@echo " make destroy - Removes containers and volumes"
@echo " make volume - Lists Docker volumes"
@echo " make build - Builds the Docker containers"
@echo " make list - Lists all Docker containers"
@echo " make link - Creates URLs for services"
@echo " make exe-backend - Executes a bash shell in the backend container"
@echo " make exe-ollama - Executes a bash shell in the ollama container"
@echo " make help - Displays this help message"
13 changes: 7 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ version: '3.8'

services:
ollama:
container_name: ${DOCKER_PREFIX}_${CONTAINER_NAME}_OPENI_OLLAMA
image: ollama/ollama:latest
ports:
- "11434:11434"
- ${OLLAMA_OPENUI_PORT}:11434
volumes:
- ${OLLAMA_VOLUME_PATH:-ollama}:/root/.ollama

backend:
container_name: ${DOCKER_PREFIX}_${CONTAINER_NAME}_OPENUI_BACKEND
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "7878:7878"
- ${BACKEND_OPENUI_PORT}:7878
environment:
- OLLAMA_HOST=http://ollama:11434
# Just remove `=xxx` to have the env variable passed forward
- OPENAI_API_KEY=xxx
- OLLAMA_HOST=ollama
- OPENAI_API_KEY=${OPENAPI_KEY}
depends_on:
- ollama
volumes:
ollama:
ollama: