version: '3.9'

services:
  mariadb:
    image: docker.io/library/mariadb:latest
    container_name: mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:?MYSQL_ROOT_PASSWORD not set}
      - MYSQL_DATABASE=${MYSQL_DATABASE:?MYSQL_DATABASE not set}
      - MYSQL_USER=${MYSQL_USER:?MYSQL_USER not set}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD:?MYSQL_PASSWORD not set}
    networks:
      - mariadb
    volumes:
      - mariadb:/var/lib/mysql
    ports:
      - "3307:3306"
    restart: unless-stopped

networks:
  mariadb:
    external: true

volumes:
  mariadb:
    external: true
