version: '3.7'

services:
  nginx:
    container_name: mp-nginx
    build:
      context: .
      dockerfile: Dockerfile-nginx
    restart: always
    volumes:
      - .:/var/www
      - 'mpstorage:/var/www/storage'
    ports:
      - 8050:80
    links:
      - "core:php-fpm"
    depends_on:
      - "core"
    networks:
      - mpnet
  core:
    container_name: mp-core
    build:
      context: .
      dockerfile: Dockerfile-phpfpm
    restart: always
    volumes:
      - .:/var/www
      - 'mpstorage:/var/www/storage'
    links:
      - "cache:redis"
    depends_on:
      - "cache"
    networks:
      - mpnet
  sched:
    container_name: mp-scheduler
    build:
      context: .
      dockerfile: Dockerfile-phpfpm
    command: /usr/local/bin/start
    restart: always
    volumes:
      - .:/var/www
      - 'mpstorage:/var/www/storage'
    links:
      - "cache:redis"
    depends_on:
      - "cache"
    networks:
      - mpnet
    user: "82:82" # www-data user
  cache:
    container_name: mp-cache
    image: redis:6-alpine
    restart: always
    networks:
      - mpnet

networks:
  mpnet:
    driver: bridge

volumes:
  mpstorage:
    driver: local
