Files
recipe-app/compose.yml
T

88 lines
2.3 KiB
YAML

services:
recipe-frontend:
build:
context: ./frontend
dockerfile: Dockerfile
image: recipe-frontend:local
container_name: recipe-frontend
restart: unless-stopped
environment:
NODE_ENV: "production"
HOSTNAME: "0.0.0.0"
PORT: "3000"
NEXT_PUBLIC_APP_URL: "${NEXT_PUBLIC_APP_URL}"
NEXT_PUBLIC_API_URL: "${NEXT_PUBLIC_API_URL}"
NEXT_PUBLIC_API_URL_INTERNAL: "http://recipe-api:8080"
volumes:
- recipe_images:/app/public/images
depends_on:
recipe-api:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3000 >/dev/null 2>&1 || exit 1"]
interval: 20s
timeout: 10s
retries: 5
start_period: 40s
networks:
- proxy
- recipe-internal
recipe-api:
build:
context: ./backend
dockerfile: Dockerfile
image: recipe-api:local
container_name: recipe-api
restart: unless-stopped
environment:
NODE_ENV: "production"
DATABASE_URL: "mysql://root:${MARIADB_ROOT_PASSWORD}@recipe-db:3306/${MARIADB_DATABASE}"
volumes:
- recipe_images:/app/recipe-images
depends_on:
recipe-db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/api/health >/dev/null 2>&1 || exit 1"]
interval: 20s
timeout: 10s
retries: 10
start_period: 40s
networks:
- proxy
- recipe-internal
recipe-db:
image: mariadb:11
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
MARIADB_DATABASE: ${MARIADB_DATABASE}
MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
volumes:
- recipe_db_data:/var/lib/mysql
- ./db/init:/docker-entrypoint-initdb.d
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD-SHELL", "mariadb-admin ping -h 127.0.0.1 -uroot -p$$MARIADB_ROOT_PASSWORD >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- recipe-internal
volumes:
recipe_db_data:
recipe_images:
networks:
proxy:
external: true
recipe-internal:
driver: bridge