version: '3.9'

services:
  niki_stage_mariadb:
    image: docker.io/bitnami/mariadb:11.1
    container_name: niki_stage_mariadb
    restart: always
    networks:
      - niki-stage
    expose:
      - "3306"
    volumes:
      - 'niki_stage_mariadb_data:/bitnami/mariadb'
    environment:
      MARIADB_USER: ${COMPOSE_MARIADB_USER?error}
      MARIADB_PASSWORD: ${COMPOSE_MARIADB_UR_PASSWORD?error}
      MARIADB_DATABASE: ${COMPOSE_MARIADB_DATABASE?error}
      MARIADB_ROOT_PASSWORD: ${COMPOSE_MARIADB_RT_PASSWORD?error}
      ALLOW_EMPTY_PASSWORD: no
    healthcheck:
      test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
      interval: 15s
      timeout: 5s
      retries: 6
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: 2048M

volumes:
  niki_stage_mariadb_data:
    driver: local

networks:
  niki-stage:
    external: true