version: "3.1"

services:

  jekyll:
    image: jekyll/jekyll:latest
    container_name: ultrasoccer-nationsleague-jekyll
    command: jekyll build --watch
    restart: always
    #ports:
    #  - ${LH_PORT:-4990}:4000
    environment:
      JEKYLL_UID: ${RUNNER_UID:-1000}
      JEKYLL_GID: ${RUNNER_GID:-1000}
    volumes:
      - ./html:/srv/jekyll

  php-server:
    build:
      context: ./services/php-server
      args:
        RUNNER_UID: ${RUNNER_UID:-1000}
        RUNNER_GID: ${RUNNER_GID:-1000}
    environment:
      MYSQL_HOST: dbhost
      MYSQL_PORT: 3306
      MYSQL_DATABASE: ${MYSQL_DATABASE:-usnldb}
      MYSQL_USER: ${MYSQL_USER:-user}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}
      AES_KEY: ${AES_KEY:-InSecureTestKey}
    container_name: ultrasoccer-nationsleague-php
    restart: always
    command: /opt/start_server.sh
    ports:
      - ${LH_PORT:-4990}:80
    depends_on:
      - jekyll
    volumes:
      - ./html/_site:/var/www/html
      - ./services/php-server/apache.conf:/etc/apache2/sites-available/000-default.conf

  dbhost:
    image: mariadb:latest
    container_name: ultrasoccer-nationsleague-db
    volumes:
      - dbhost_data:/var/lib/mysql
      #- ./stargate/functions/sql:/opt/sql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
      MYSQL_DATABASE: ${MYSQL_DATABASE:-usnldb}
      MYSQL_USER: ${MYSQL_USER:-user}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: ultrasoccer-nationsleague-pma
    environment:
      PMA_HOST: dbhost
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
    restart: always
    ports:
      - ${LH_PORT_stargate_pma:-8081}:80

volumes:
    dbhost_data:
