version: "3"
services:
  # PHP
  php:
    image: starter_php:7.4
    container_name: php
    build: docker/php
    restart: always
    environment:
      DATABASE_HOST: mysql
    volumes:
      - ./:/project:delegated
    user: ${APP_USER_ID}:${APP_GROUP_ID}
    depends_on:
      - mysql
      - maildev
    env_file:
      - .env

  # Node
  node:
    image: starter_node:16
    container_name: node
    build: docker/node
    tty: true
    user: ${APP_USER_ID}:${APP_GROUP_ID}
    volumes:
      - ./:/project:delegated
      - ${PNPM_STORE}:/project/.pnpm-store
    working_dir: /project/front
    env_file:
      - .env

  # Apache
  httpd:
    image: starter_httpd:2.4
    container_name: httpd
    build: docker/httpd
    volumes:
      - ./:/project:delegated
    depends_on:
      - php

  # MySQL
  mysql:
    image: starter_mysql:5.7
    container_name: mysql
    build: docker/mysql
    restart: always
    environment:
      - "MYSQL_ROOT_PASSWORD=root"
      - "MYSQL_USER=drupal"
      - "MYSQL_PASSWORD=drupal"
      - "MYSQL_DATABASE=drupal"
    volumes:
      - db:/var/lib/mysql

  # Maildev
  maildev:
    image: djfarrelly/maildev
    container_name: maildev

# Volumes
volumes:
  db:
