diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 1dfcc49..2ec8836 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,3 +1,5 @@ +version: "3.8" + services: lifehub-mariadb: image: mariadb:latest @@ -14,19 +16,35 @@ services: volumes: - dbdata:/var/lib/mysql - ./init-scripts/mariadb:/docker-entrypoint-initdb.d + healthcheck: + test: + [ + "CMD", + "mariadb-admin", + "ping", + "-h", + "localhost", + "-u", + "${MARIADB_USER}", + "-p${MARIADB_PASSWORD}", + ] + interval: 10s + retries: 5 + start_period: 20s lifehub-vault: image: hashicorp/vault:latest container_name: lifehub-vault environment: - - VAULT_DEV_ROOT_TOKEN_ID=dev-root-token - - VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200 + VAULT_DEV_ROOT_TOKEN_ID: ${VAULT_DEV_ROOT_TOKEN_ID:-dev-root-token} + VAULT_DEV_LISTEN_ADDRESS: "0.0.0.0:8200" ports: - "8200:8200" cap_add: - IPC_LOCK depends_on: - - lifehub-mariadb + lifehub-mariadb: + condition: service_healthy volumes: - vault-data:/vault/data @@ -36,19 +54,21 @@ services: dockerfile: Dockerfile.dev container_name: lifehub-backend environment: - - DB_HOST=lifehub-mariadb - - DB_NAME=${MARIADB_DATABASE} - - FRONTEND_URL=http://localhost - - VAULT_ADDR=http://lifehub-vault:8200 - - VAULT_TOKEN=${VAULT_TOKEN} - - VAULT_DB_USER=${VAULT_DB_USER} - - VAULT_DB_PASSWORD=${VAULT_DB_PASSWORD} - - ENVIRONMENT=development + DB_HOST: lifehub-mariadb + DB_NAME: ${MARIADB_DATABASE} + FRONTEND_URL: http://localhost + VAULT_ADDR: http://lifehub-vault:8200 + VAULT_TOKEN: ${VAULT_TOKEN} + VAULT_DB_USER: ${VAULT_DB_USER} + VAULT_DB_PASSWORD: ${VAULT_DB_PASSWORD} + ENVIRONMENT: development ports: - "8000:8000" depends_on: - - lifehub-mariadb - - lifehub-vault + lifehub-mariadb: + condition: service_healthy + lifehub-vault: + condition: service_started volumes: - ./backend:/app @@ -58,18 +78,20 @@ services: dockerfile: Dockerfile.dev container_name: lifehub-frontend environment: - - VITE_BACKEND_URL=http://lifehub-backend:8000 - - VITE_SESSION_SECRET=${SESSION_SECRET} + VITE_BACKEND_URL: http://lifehub-backend:8000 + VITE_SESSION_SECRET: ${SESSION_SECRET} ports: - "80:5173" depends_on: - - lifehub-backend + lifehub-backend: + condition: service_started volumes: - ./frontend:/app - node_modules:/usr/src/app/node_modules volumes: node_modules: + driver: local dbdata: driver: local vault-data: