name: urban-canopee
services:
  api:
    build: .
    container_name: urban-canopee-api
    volumes:
      - .env:/code/.env
      - ./storage:/code/storage
    ports:
      - "8080:80"
    networks:
      - app_network
    depends_on:
      database:
        condition: service_healthy

  database:
    image: mysql
    container_name: urban-canopee-database
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: urban_canopee
    expose:
      - 3306
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - app_network
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 3

  mailhog:
    image: mailhog/mailhog:latest
    networks:
      - app_network
    ports:
      - 8025:8025

networks:
  app_network:
    driver: bridge

volumes:
  db_data:
    driver: local
