version: '3.2'

networks:
  halonet:
    driver: bridge

services:
  mariadb:
    restart: always
    image: mariadb:10-focal
    networks:
      - halonet
    volumes:
      - .data:/var/lib/mysql
    environment:
      - MYSQL_USER=hb
      - MYSQL_PASSWORD=hb
      - MYSQL_ROOT_PASSWORD=hb
      - MYSQL_DATABASE=hb_game

  hb:
    image: hb
    container_name: hb
    depends_on:
      - mariadb
    networks:
      - halonet
    volumes:
      - ./htdocs:/usr/src/hb-main/htdocs:rw
      - ./onyx2:/usr/src/hb-main/onyx2:rw
      # make cache and compile writable + don't add file to local host
      - /usr/src/hb-main/onyx2/cache
      - /usr/src/hb-main/onyx2/log
      - /usr/src/hb-main/onyx2/modules/templates/compile
    environment:
      - MYSQL_DATABASE=hb_game
      - MYSQL_HOST=mariadb
      - MYSQL_USER=hb
      - MYSQL_PASSWORD=hb
      - DISABLE_TLS=true
      - DEV=true

  nginx:
    image: nginx:1-alpine
    depends_on:
      - hb
    networks:
      - halonet
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - ./htdocs:/usr/src/hb-main/htdocs:ro
    ports:
      - "8080:80"
