version: '3.4'

services:
  snc_demo_caddy:
    hostname: snc_demo_caddy
    container_name: snc_demo_caddy
    restart: unless-stopped
    build:
      context: .
      dockerfile: docker/caddy/Dockerfile
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - caddy_data:/data
      - caddy_config:/config
      - ./docker/caddy/caddy:/etc/caddy:cached

  snc_demo_db:
    hostname: snc_demo_db
    container_name: snc_demo_db
    build:
      context: .
      dockerfile: docker/db/Dockerfile
    restart: always
    ports:
      - "3306:3306"
    environment:
      - MYSQL_DB=${MYSQL_DB}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
    volumes:
      - mysqldata:/var/lib/mysql

  snc_demo_api:
    hostname: snc_demo_api
    container_name: snc_demo_api
    build:
      context: .
      dockerfile: docker/api/Dockerfile
      args:
        - OS=${OS}
    restart: always
    environment:
      - PHP_IDE_CONFIG=serverName=api
      - HTTPS_METHOD=noredirect
    volumes:
      - ./api:/var/www/html:cached
      - ./api/vendor:/var/www/html/vendor:delegated
      - appdata5:/var/www/html/var/cache/
      - appdata5:/var/www/html/var/logs/
    depends_on:
      - snc_demo_db

  snc_demo_app:
    hostname: snc_demo_app
    container_name: snc_demo_app
    build:
      context: .
      dockerfile: docker/app/Dockerfile
    tty: true
    ports:
      - "3002:3002"
      - "3003:3003"
    environment:
      - NODE_ENV=docker
      - HTTPS_METHOD=noredirect
    volumes:
      - ./app:/var/app:rw,cached
    depends_on:
      - snc_demo_api

volumes:
  mysqldata: ~
  appdata5: ~
  caddy_data: ~
  caddy_config: ~

