# Preview locale PIPE2.0 — PHP/Apache + MySQL + Mailpit
# Lancer :  docker compose up -d --build
# Site   :  http://localhost:8080
# Mails  :  http://localhost:8025   (Mailpit, capture les devis envoyés)

services:
  web:
    build: ./docker
    ports:
      - "8080:80"
    volumes:
      - ./site:/var/www/html
      - ./docker/config.docker.php:/var/www/html/config.php:ro
    depends_on:
      db:
        condition: service_healthy
      mailpit:
        condition: service_started

  db:
    image: mysql:8
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: pipe20
      MYSQL_USER: pipe20
      MYSQL_PASSWORD: pipe20
    volumes:
      - ./site/sql/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
      - pipe20_db:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-proot"]
      interval: 5s
      timeout: 5s
      retries: 20

  mailpit:
    image: axllent/mailpit:latest
    ports:
      - "8025:8025"

volumes:
  pipe20_db:
