name: pma
services:
  phpmyadmin:
    image: phpmyadmin
    container_name: "${COMPOSE_PROJECT_NAME}-phpmyadmin"
    environment:
      PMA_HOST: database
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      UPLOAD_LIMIT: ${UPLOAD_LIMIT}
      MEMORY_LIMIT: ${MEMORY_LIMIT}
    expose:
      - "80"
    labels:
      - traefik.enable=true
      - traefik.http.routers.pma.rule=Host(`${SERVER_NAME}`)
      - traefik.http.routers.pma.entrypoints=websecure
      - traefik.http.routers.pma.tls=true
      - traefik.http.services.pma.loadbalancer.server.port=80
      - traefik.docker.network=mozart-network
    extra_hosts:
      - "host.docker.internal:host-gateway"
    ports:
      - "${HOST_MACHINE_PMA_PORT}:80"
      - "${HOST_MACHINE_PMA_SECURE_PORT}:443"
    volumes:
      - /sessions
      - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
      - ../../../infra/certs:/etc/ssl/certs:ro
    networks:
      - mozart-network
networks:
  mozart-network:
    external: true