services:
  api:
    build: .
    ports:
      - "8081:8080"
    env_file:
      - ./.env
    depends_on:
      db:
        condition: service_healthy
    networks:
      - shared-network
  db:
    image: mysql:8.0
    container_name: thedilution_mysql_db
    # ... rest of your db service is the same ...
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-u", "${DB_USER}", "-p${DB_PASSWORD}"]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    ports:
      - "3307:3306"
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    networks:
      - shared-network

volumes:
  db_data:

networks:
  shared-network:
    external: true