version: "3"

services:
  apache:
    image: bitnami/apache:latest
    restart: always
    volumes:
      - ./public_html:/app:rw
      - ./docker/apache/vhosts.conf:/vhosts/app.conf
    ports:
      - "8080:8080"
    networks:
      - metafox-tier
  
  php-fpm:
    image: foxsystem/metafox-fpm:latest
    restart: unless-stopped
    env_file:
      - ./docker/server.env
    volumes:
      - ./public_html:/app
    networks:
      - metafox-tier

  redis:
    image: bitnami/redis:latest
    restart: unless-stopped
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    networks:
      - metafox-tier
  
  postgres:
    image: foxsystem/postgres:13.2
    restart: always
    env_file:
      - ./docker/server.env
    volumes:
      - ./docker/postgres-data:/var/lib/postgresql
    networks:
      - metafox-tier

  queue-worker:
    image: foxsystem/metafox-fpm:latest
    restart: unless-stopped
    env_file:
      - ./docker/server.env
    volumes:
      - ./public_html:/app
    depends_on:
      - "postgres"
      - "redis"
    networks:
      - metafox-tier
    command: ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]

  queue:
    image: rabbitmq:3-management
    restart: unless-stopped
    volumes:
      - ./docker/queue-data:/bitnami
    networks:
      - metafox-tier
      
  frontend-build:
    image: foxsystem/metafox-frontend-build:latest
    restart: unless-stopped
    volumes:
      - ./frontend_web:/app
    networks:
      - metafox-tier

networks:
  metafox-tier:
    driver: bridge
