feat: loading all images from docker hub option

This commit is contained in:
Yassine Sallemi 2024-09-20 18:28:55 +01:00
parent 165fcbde64
commit 509dc2381b
5 changed files with 42 additions and 36 deletions

View File

@ -1,5 +1,4 @@
# Default path setup
COMPOSE_FILES := -f ./docker/docker-compose.yml -f ./docker/docker-compose.dev.yml
COMPOSE_FILES := -f ./docker/docker-compose.yml
# Function to add service files
define add_service
@ -8,7 +7,7 @@ define add_service
ifneq ($(wildcard ./docker/docker-compose.$(1).prod.yml),)
COMPOSE_FILES += -f ./docker/docker-compose.$(1).prod.yml
endif
else
else ifeq ($(DEV_MODE), true)
COMPOSE_FILES += -f ./docker/docker-compose.$(1).yml
ifneq ($(wildcard ./docker/docker-compose.$(1).dev.yml),)
COMPOSE_FILES += -f ./docker/docker-compose.$(1).dev.yml
@ -17,18 +16,20 @@ define add_service
endef
# Check if services are specified and add corresponding compose files
ifneq ($(NGINX),)
$(eval $(call add_service,nginx))
endif
ifneq ($(NLU),)
$(eval $(call add_service,nlu))
endif
ifneq ($(SMTP4DEV),)
$(eval $(call add_service,smtp4dev))
endif
# Function to set up COMPOSE_FILES
define compose_files
ifeq ($(1), true)
ifneq ($(wildcard ./docker/docker-compose.dev.yml),)
COMPOSE_FILES += -f ./docker/docker-compose.dev.yml
endif
endif
ifneq ($(NGINX),)
$(eval $(call add_service,nginx))
endif
ifneq ($(NLU),)
$(eval $(call add_service,nlu))
endif
endef
# Ensure .env file exists and matches .env.example
check-env:
@ -43,16 +44,21 @@ init:
cp ./docker/.env.example ./docker/.env
dev: check-env
$(eval $(call compose_files,true))
docker compose $(COMPOSE_FILES) up -d
start: check-env
docker compose $(COMPOSE_FILES) up -d --build
$(eval $(call compose_files,false))
docker compose $(COMPOSE_FILES) up -d
stop: check-env
$(eval $(call compose_files,true))
docker compose $(COMPOSE_FILES) down
destroy: check-env
$(eval $(call compose_files,true))
docker compose $(COMPOSE_FILES) down -v
migrate-up:
$(eval $(call compose_files,false))
docker-compose $(COMPOSE_FILES) up --no-deps -d database-init

View File

@ -2,12 +2,16 @@ version: "3.8"
services:
database-init:
build:
context: ../api
volumes:
- ../api/src:/app/src
- ../api/migrations:/app/migrations
# - ../api/node_modules:/app/node_modules
api:
build:
context: ../api
ports:
- ${API_PORT}:3000
- 9229:9229 # vscode debug port
@ -30,8 +34,15 @@ services:
ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_PASSWORD}
ME_CONFIG_MONGODB_URL: ${MONGO_URI}
hexabot-frontend:
container_name: frontend
build:
context: ../
dockerfile: ./frontend/Dockerfile
widget:
build:
context: ../widget
target: development
volumes:
- ../widget/src:/app/src

View File

@ -2,5 +2,8 @@ version: "3.9"
services:
nlu-api:
build:
context: ../nlu
dockerfile: Dockerfile
ports:
- ${NLP_PORT}:5000

View File

@ -10,9 +10,7 @@ services:
nlu-api:
container_name: nlu-api
build:
context: ../nlu
dockerfile: Dockerfile
image: hexabot-nlu:latest
env_file: .env
networks:
- nlp-network

View File

@ -3,8 +3,7 @@ version: "3.9"
services:
database-init:
container_name: database-init
build:
context: ../api
image: hexabot-api:latest
command: sh -c "npm run cache:init && npm run migrate prune && npm run migrate up"
env_file: .env
networks:
@ -15,8 +14,7 @@ services:
api:
container_name: api
build:
context: ../api
image: hexabot-api:latest
env_file: .env
ports:
- ${API_PORT}:3000
@ -40,12 +38,7 @@ services:
hexabot-frontend:
container_name: frontend
build:
context: ../
dockerfile: ./frontend/Dockerfile
args:
- NEXT_PUBLIC_API_ORIGIN=${NEXT_PUBLIC_API_ORIGIN}
- NEXT_PUBLIC_SSO_ENABLED=${NEXT_PUBLIC_SSO_ENABLED}
image: hexabot-ui:latest
env_file: .env
ports:
- ${APP_FRONTEND_PORT}:8080
@ -75,12 +68,7 @@ services:
widget:
container_name: widget
build:
context: ../widget
args:
REACT_APP_WIDGET_API_URL: ${REACT_APP_WIDGET_API_URL}
REACT_APP_WIDGET_CHANNEL: ${REACT_APP_WIDGET_CHANNEL}
REACT_APP_WIDGET_TOKEN: ${REACT_APP_WIDGET_TOKEN}
image: hexabot-widget:latest
networks:
- app-network
depends_on: