version: '3.1'

services:
  niki_stage_mariadb:
    image: docker.io/bitnami/mariadb:11.1
    container_name: niki_stage_mariadb
    restart: always
    ports:
      - '127.0.0.1:3429:3306'
    networks:
      - niki-stage
    volumes:
      - 'niki_stage_mariadb_data:/bitnami/mariadb'
    environment:
      - MARIADB_USER=niki
      - MARIADB_PASSWORD=${NIKI_STAGE_MARIADB_UR_PASSWORD}
      - MARIADB_DATABASE=niki_db
      - MARIADB_ROOT_PASSWORD=${NIKI_STAGE_MARIADB_RT_PASSWORD}
      - 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