version: '3.8'
services:
  nginx:
    image: nginx:1.19.7-alpine
    restart: always
    ports:
      - "4444:80"
    depends_on:
      - frontend
    command: nginx -g "daemon off;"
    volumes: 
      - ./apps/web/ws-nginx.local.conf:/etc/nginx/conf.d/default.conf
      - ./tmp/:/tmp/workspaces_tmp
  db:
    image: marconi.aoc.nrao.edu/ops/ci/db:workspaces
    restart: always
    ports:
      - "54322:5432"
    environment:
      POSTGRES_USER: archive
      POSTGRES_PASSWORD: docker
    command: postgres -c listen_addresses=*

  amqp:
    image: rabbitmq:3.8-management
    restart: always
    ports:
      - "15672:15672"

  schema:
    build:
      context: ./schema/
      dockerfile: Dockerfile.local
    depends_on:
      - db
    volumes:
      - ./schema:/code/schema

  workflow:
    build:
      context: .
      dockerfile: ./services/workflow/Dockerfile.local
    ports:
      - "3456:3456"
    depends_on:
      - schema
    volumes:
      - ./services/workflow:/code
      - ./shared:/packages/shared
      - ./apps:/packages/apps
      - ./testing:/packages/testing
      - ./tmp/:/tmp/workspaces_tmp

  capability:
    build:
      context: .
      dockerfile: ./services/capability/Dockerfile.local
    ports:
      - "3457:3457"
    depends_on:
      - schema
      - workflow
      - notification
    volumes:
      - ./services/capability:/code
      - ./shared:/packages/shared
      - ./apps:/packages/apps
      - ./testing:/packages/testing

  notification:
    build:
      context: .
      dockerfile: ./services/notification/Dockerfile.local
    ports:
      - "3458:3458"
    depends_on:
      - schema
    volumes:
      - ./services/notification:/code
      - ./shared:/packages/shared
      - ./apps:/packages/apps
      - ./testing:/packages/testing

  frontend:
    build:
      context: .
      dockerfile: ./apps/web/Dockerfile.local
    init: true
    ports:
      - "4200:4200"
    volumes:
      - ./apps/web:/code
      - /code/node_modules
