services:
  mysql:
    image: mysql:8.4
    container_name: mysql-voipmundo
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: admin123456
      MYSQL_DATABASE: voipmund_sitenovo
    ports: ["3306:3306"]
    volumes: ["mysql_data:/var/lib/mysql"]
    command: >
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_unicode_ci
      --explicit_defaults_for_timestamp=ON
      --default-time-zone=+00:00
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-padmin123456"]
      interval: 10s
      timeout: 5s
      retries: 10

  adminer:
    image: adminer:latest
    container_name: adminer-voipmundo
    restart: unless-stopped
    ports: ["8080:8080"]
    depends_on: [mysql]

  api:
    build:
      context: .                       # 👈 raiz do repo
      dockerfile: ./src/API.WebHost/Dockerfile
    container_name: voipmundo-api
    restart: unless-stopped
    environment:
      ASPNETCORE_ENVIRONMENT: Development
      ASPNETCORE_URLS: http://+:5005
      ConnectionStrings__Default: "Server=mysql;Port=3306;Database=voipmund_sitenovo;User=root;Password=admin123456;SslMode=None;Allow User Variables=true;"
    ports: ["5005:5005"]
    depends_on:
      mysql:
        condition: service_healthy

volumes:
  mysql_data:
