services:
  php:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    container_name: mercuriale_php
    volumes:
      - .:/var/www/html
      - ./docker/php/php.ini:/usr/local/etc/php/conf.d/custom.ini
    depends_on:
      - database
    networks:
      - mercuriale

  nginx:
    image: nginx:alpine
    container_name: mercuriale_nginx
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
    networks:
      - mercuriale

  database:
    image: mysql:8.0
    container_name: mercuriale_database
    environment:
      MYSQL_ROOT_PASSWORD: root_password
      MYSQL_DATABASE: mercuriale
      MYSQL_USER: mercuriale
      MYSQL_PASSWORD: mercuriale_dev
    ports:
      - "3307:3306"
    volumes:
      - database_data:/var/lib/mysql
    networks:
      - mercuriale
    command: --default-authentication-plugin=caching_sha2_password

  mailpit:
    image: axllent/mailpit
    container_name: mercuriale_mailpit
    ports:
      - "8025:8025"
      - "1025:1025"
    networks:
      - mercuriale

networks:
  mercuriale:
    driver: bridge

volumes:
  database_data:
