version: '3.8'

services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    working_dir: /var/www
    volumes:
      - ./:/var/www:cached
      - ./docker/php/memory.ini:/usr/local/etc/php/conf.d/memory.ini:ro
    environment:
      COMPOSER_ALLOW_SUPERUSER: "1"
    mem_limit: 1G
    deploy:
      resources:
        limits:
          memory: 1G
    networks:
      - appnet

  nginx:
    image: nginx:1.25-alpine
    ports:
      - "8080:80"
    volumes:
      - ./:/var/www:ro
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - php
    networks:
      - appnet

networks:
  appnet:
    driver: bridge
