version: '3'

services:
  db:
    command: --init-file /data/init.sql
    image: mariadb:latest
    environment:
      MYSQL_ROOT_PASSWORD: azerty
      MYSQL_DATABASE: app
    volumes:
      - ./docker/bin/init.sql:/data/init.sql
  http:
    image: nginx:alpine
    depends_on:
      - db
    ports:
      - 8000:80
    volumes:
      - ./docker/etc/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
      - ./app/wordpress:/src
    working_dir: /src
  mailhog:
    image: mailhog/mailhog
    ports:
      - "8025:8025"
      - "1025:1025"
  node-front:
    image: node:lts-alpine
    command: ["yarn", "start"]
    volumes:
      - ./app/wordpress:/src
    working_dir: /src/wp-content/themes/app
  php:
    build: docker/images/php
    depends_on:
      - db
    volumes:
      - ./docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro
      - ./docker/etc/php/php-cli.ini:/usr/local/etc/php/php-cli.ini:ro
      - ./app/wordpress:/src
    working_dir: /src
  phpmyadmin:
    image: phpmyadmin:latest
    depends_on:
      - db
    environment:
      PMA_HOST: db
      PMA_PASSWORD: azerty
      UPLOAD_LIMIT: 500M
    ports:
      - "8001:80"
