version: "3.9"
services:

  webbooker:
    build:
      context: .
      dockerfile: dockerfile
    ports:
      - "7080:80"
      - "7443:443"
    volumes:
      - ./front-end:/var/www/html/front-end
      - ./backend:/var/www/html/backend
      - ./vendor:/var/www/html/vendor
      - ./autocab:/var/www/html/autocab
      - ./icabbi:/var/www/html/icabbi
      - ./common:/var/www/html/common
      - ./config:/var/www/html/config
      - ./install:/var/www/html/install
      - ./src:/var/www/html/src
      - ./dispatch:/var/www/html/dispatch
      - ./dist:/var/www/html/dist
      - ./tests:/var/www/html/tests
    environment:
      XDEBUG_CONFIG: "client_host=host.docker.internal"
      XDEBUG_MODE: "debug"
    restart: unless-stopped
    depends_on:
      - db
      - session-db
    secrets:
      - server_cert
      - server_cert_key
    extra_hosts:
      - "host.docker.internal:host-gateway"
  db:
    image: mariadb:latest
    environment:
      MYSQL_DATABASE: ebooking
      MYSQL_ROOT_PASSWORD: SQ6UyeUjf99LZjDDYa2J6yxK
      MYSQL_USER: ebooking_user
      MYSQL_PASSWORD: SQ6UyeUjf99LZjDDYa2J6yxK
    ports:
      - "4310:3306"
    volumes:
      - ./scratch/docker/mysql:/var/lib/mysql
    restart: unless-stopped
  session-db:
    image: mariadb:latest
    environment:
      MYSQL_DATABASE: secure_sessions
      MYSQL_ROOT_PASSWORD: session
      MYSQL_USER: session_user
      MYSQL_PASSWORD: session_user
    ports:
      - "4311:3306"
    volumes:
      - ./scratch/docker/mysql-session:/var/lib/mysql
    restart: unless-stopped
  unit-test-db:
    image: mariadb:latest
    environment:
      MYSQL_DATABASE: ebooking
      MYSQL_ROOT_PASSWORD: SQ6UyeUjf99LZjDDYa2J6yxK
      MYSQL_USER: ebooking_user
      MYSQL_PASSWORD: SQ6UyeUjf99LZjDDYa2J6yxK
    ports:
      - "4312:3306"
    restart: unless-stopped
secrets:
  server_cert:
    file: ./config/cert.pem
  server_cert_key:
    file: ./config/private.key