services:
  server:
    build: .
    depends_on:
      - db
    restart: always
    volumes:
      - "bcache:/app/Server/target"
      - "mcache:/root/.m2"
      - "./Server/data:/app/Server/data"
      - "./config:/app/Server/worldprops"
    ports:
      - "43594-43600:43594-43600"

  db:
    # current LTS (Long-Term Support) version
    image: mariadb:11.4-noble
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 30s
      interval: 60s
      timeout: 10s
      retries: 3
    restart: always
    volumes:
      - "./db:/var/lib/mysql"
      - "./Server/db_exports/global.sql:/docker-entrypoint-initdb.d/global.sql"
    env_file:
      - mysql.env

volumes:
  bcache:
  mcache:
