services:
  romm:
    image: rommapp/romm:latest
    container_name: romm
    restart: unless-stopped
    environment:
      DB_HOST: mariadb
      DB_NAME: ${ROMM_DB_NAME}
      DB_USER: ${ROMM_DB_USER}
      DB_PASSWD: ${ROMM_DB_PASS}
      ROMM_AUTH_SECRET_KEY: ${ROMM_AUTH_SECRET_KEY}
      IGDB_CLIENT_ID: ${IGDB_CLIENT_ID}
      IGDB_CLIENT_SECRET: ${IGDB_CLIENT_SECRET}
      SCREENSCRAPER_USER: ${SCREENSCRAPER_USER}
      SCREENSCRAPER_PASSWORD: ${SCREENSCRAPER_PASSWORD}
    volumes:
      - C:\RomM\roms:/romm/library/roms
      - C:\RomM\bios:/romm/library/bios
      - C:\RomM\assets:/romm/assets
      - romm_resources:/romm/resources
      - romm_redis_data:/redis-data
    ports:
      - "8080:8080"
    depends_on:
      mariadb:
        condition: service_healthy

  mariadb:
    image: mariadb:11.4
    container_name: romm-mariadb
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: ${ROMM_DB_ROOT_PASS}
      MARIADB_DATABASE: ${ROMM_DB_NAME}
      MARIADB_USER: ${ROMM_DB_USER}
      MARIADB_PASSWORD: ${ROMM_DB_PASS}
    volumes:
      - romm-db:/var/lib/mysql
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 10s
      timeout: 5s
      retries: 10

volumes:
  romm-db:
  romm_resources:
  romm_redis_data: