version: '3'
services:

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: phpmyadmin
    restart: unless-stopped
    ports:
      - '8080:80'
      #- '8443:443'
    volumes:
      - "./etc/phpmyadmin/config.inc.php:/var/www/html/config.inc.php:ro" # phpMyAdmin config is located in etc
    environment:
      PMA_HOST: mariadb

  nginx:
    image: nginx:latest
    container_name: nginx
    restart: unless-stopped
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - "./portal:/var/www/html/portal" # Laravel
      - "./board:/var/www/html/portal/public/board" # PhpBB forum
      - "./etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro"
      - "./etc/nginx/sites-available:/etc/nginx/sites-available:ro"
      - "./etc/nginx/sites-enabled:/etc/nginx/sites-enabled:ro"
      - "./etc/nginx/conf.d:/etc/nginx/conf.d:ro" # Nginx server config directory
      - "./etc/nginx/log:/var/log/nginx" # Error log
      - "./etc/nginx/ssl:/etc/nginx/ssl" # Nginx SSL cert path
      - "./wiki:/var/www/html/portal/public/wiki" # MediaWiki
      #- "./wiki/images:/var/www/html/portal/public/wiki/images" # Persistent image storage
      #- "./wiki/skins:/var/www/html/portal/public/skins" # Persistent theme storage
      - "./etc/wiki/LocalSettings.php:/var/www/html/portal/public/wiki/LocalSettings.php:ro" # MediaWiki config

  php:
    #build:
    #  context: "./etc/php"
    #  dockerfile: Dockerfile
    #  args:
    #    buildno: 1
    image: blackwolfmarwood/openrsc-php:latest
    container_name: php
    restart: unless-stopped
    ports:
      - "127.0.0.1:9000:9000" # PHP-FPM proxied through Nginx
      - "1337:1337"
    volumes:
      - "./etc/php/php.ini:/usr/local/etc/php/conf.d/php.ini:ro" # PHP config
      - "./portal:/var/www/html/portal" # Laravel
      - "./board:/var/www/html/portal/public/board" # PhpBB forum
      - "./wiki:/var/www/html/portal/public/wiki" # MediaWiki
      - "./etc/wiki/LocalSettings.php:/var/www/html/portal/public/wiki/LocalSettings.php:ro" # MediaWiki config

networks: # MariaDB SQL server shared with the game server(s)
  default:
    name: database
