version: "3.8"
networks:
  backend:
    name: "${COMPOSE_PROJECT_NAME:-laravel}.${APP_ENV:-local}_network"
services:
  web:
    container_name: "${COMPOSE_PROJECT_NAME:-laravel}.${APP_ENV:-local}.apache"
    build:
      context: "../../docker/apache"
      target: "local"
    image: "${COMPOSE_PROJECT_NAME:-laravel}/apache"
    working_dir: /var/www
    ports:
      - "9001:80"
    volumes:
      - "../../src:/var/www:cached"
    depends_on:
      - "mysql"
    networks:
      - "backend"

  mysql:
    container_name: "${COMPOSE_PROJECT_NAME:-laravel}.${APP_ENV:-local}.mysql"
    image: "mysql:8.0"
    volumes:
      - "db_data:/var/lib/mysql"
    environment:
      MYSQL_ROOT_PASSWORD: "mysql"
      MYSQL_USER: "default"
      MYSQL_PASSWORD: "secret"
      MYSQL_DATABASE: "${COMPOSE_PROJECT_NAME:-laravel}_db"
      TZ: "Asia/Tokyo"
    ports:
      - "3308:3306"
    networks:
      - "backend"

  mailpit:
    container_name: "${COMPOSE_PROJECT_NAME:-laravel}.${APP_ENV:-local}.mailpit"
    image: "axllent/mailpit:latest"
    ports:
      - "${FORWARD_MAILPIT_PORT:-1025}:1025"
      - "${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025"
    networks:
      - "backend"

volumes:
  db_data:
