version: '3.8'

services:
  app:
    build:
      context: .
      target: production
    container_name: rapiserv-app
    restart: always
    volumes:
      - ./php/conf.d/opcache.ini:/usr/local/etc/php/conf.d/opcache.ini
    networks:
      - rasurv-network

  webserver:
    image: nginx:alpine
    container_name: rapiserv-nginx
    restart: always
    ports:
      - "8000:80"
    volumes:
      - ./:/var/www/html
      - ./nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - rasurv-network
    depends_on:
      - app

  queue:
    build:
      context: .
      target: production
    container_name: rapiserv-queue
    restart: always
    command: php artisan queue:work --tries=3
    volumes:
      - ./php/conf.d/opcache.ini:/usr/local/etc/php/conf.d/opcache.ini
    networks:
      - rasurv-network
    depends_on:
      - app

  scheduler:
    build:
      context: .
      target: production
    container_name: rapiserv-scheduler
    restart: always
    command: php artisan schedule:work
    volumes:
      - ./php/conf.d/opcache.ini:/usr/local/etc/php/conf.d/opcache.ini
    networks:
      - rasurv-network
    depends_on:
      - app

networks:
  rasurv-network:
    external: true
