services:
  app:
    container_name: shams_app
    image: shams-laravel
    build:
      context: .
      dockerfile: Dockerfile
    restart: unless-stopped
    networks:
      - shams_network
    volumes:
      - shams_laravel_storage:/var/www/html/storage
    ports:
      - "15000:80"
    command: sh -c "php-fpm -D && nginx -g 'daemon off;'"

  worker:
    container_name: shams_worker
    image: shams-laravel
    restart: unless-stopped
    networks:
      - shams_network
    volumes:
      - shams_laravel_storage:/var/www/html/storage
    depends_on:
      - app
    command: [ "supervisord", "-c", "/etc/supervisord.conf" ]

  scheduler:
    container_name: shams_scheduler
    image: shams-laravel
    restart: unless-stopped
    networks:
      - shams_network
    volumes:
      - shams_laravel_storage:/var/www/html/storage
    depends_on:
      - app
    command: ["supercronic", "/etc/cron.d/laravel-scheduler"]

networks:
  shams_network:
    driver: bridge
    name: shams_network
    external: true

volumes:
  shams_laravel_storage:

