services:
  php:
    build:
      context: ./docker/php
      dockerfile: Dockerfile
      target: dev
    volumes:
      - .:/var/www/html:cached
    depends_on:
      - db
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html:cached
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - php
    restart: unless-stopped

  db:
    image: mariadb:11
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: blog_web
      MYSQL_USER: app
      MYSQL_PASSWORD: app
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3307:3306"
    restart: unless-stopped

  mailer:
    image: axllent/mailpit
    ports:
      - "1025:1025"
      - "8025:8025"
    restart: unless-stopped

volumes:
  db_data:
