version: '3.8'

services:
  database:
    image: mysql:8.0
    container_name: database
    environment:
      - MYSQL_DATABASE=saltcave_dev
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - ./infrastructure/mysql-data:/var/lib/mysql
    ports:
      - '3306:3306'

  api:
    container_name: api
    environment:
      - LOG_CHANNEL=daily
      - APP_ENV=local
      - APP_DEBUG=true
    build:
      context: ./infrastructure/php
    ports:
      - '8080:80'
    volumes:
      - ./server:/var/www/saltcave
      - ./infrastructure/apache/default.conf:/etc/apache2/sites-enabled/000-default.conf
    depends_on:
      - database

  mailhog:
    image: mailhog/mailhog:latest
    container_name: mailhog
    ports:
      - '1025:1025'
      - '8025:8025'