version: '3.9'

services:
  myapi:
    image: mcr.microsoft.com/dotnet/aspnet:8.0
    container_name: backend-dgb_mobile_citoyen
    restart: always
    ports:
      - "5000:5000"
    volumes:
      - ./publish:/app
    working_dir: /app
    command: ["dotnet", "MobileCitoyenExchange.dll"]
    env_file:
      - .env
    environment:
      - ASPNETCORE_ENVIRONMENT=${ASPNETCORE_ENVIRONMENT}
      - ASPNETCORE_URLS=${ASPNETCORE_URLS}
      - ConnectionStrings__DefaultConnection=server=${DB_HOST};port=${DB_PORT};database=${DB_NAME};user=${DB_USER};password=${DB_PASSWORD}
    networks:
      - dgb_mobile_citoyen_net
    depends_on:
      - mysql
 
  mysql:
    image: docker.io/library/mysql:8.0
    container_name: dgb_mobile_citoyen-mysql
    restart: always
    env_file:
      - .env
    volumes:
      - mysql_data:/var/lib/mysql
    ports:
      - "3309:3306"
    networks:
      - dgb_mobile_citoyen_net
  
volumes:
  mysql_data:

networks:
  dgb_mobile_citoyen_net:
    driver: bridge
