version: '3'

services:
  db:
    image: mysql:8
    volumes:
      - mysql:/var/lib/mysql
    env_file:
      - .env

  nginx:
    build:
      context: ./docker/nginx
      dockerfile: Dockerfile
    image: ${DOCKER_IMAGE_NGINX}
    container_name: nginx
    ports:
      - ${HTTPD_PORT}:80
      - 443:443
    volumes:
      - ./docker/nginx/default:/etc/nginx/conf.d/default.conf:ro
      - .:/var/www/gestion-rgpd/:delegated
      - ./docker/nginx/certificats:/etc/letsencrypt
    depends_on:
      - php

  php:
    build:
      context: ./docker/php
      dockerfile: Dockerfile
    image: ${DOCKER_IMAGE_PHP}
    container_name: php
    volumes:
      - .:/var/www/gestion-rgpd/:delegated
      - ./docker/php/php.ini:/usr/local/etc/php/php.ini:ro
    working_dir: /var/www/gestion-rgpd/
    depends_on:
      - db

volumes:
  mysql:
