version: '3.9'

services:
  app:
    build:
      context: .
    ports:
      - "8100:8100"
      - "3001:3001"
    command: yarn watch
    volumes:
      - nodemodules:/app/node_modules
      - type: bind
        source: ./source
        target: /app/source
      - type: bind
        source: ./dist
        target: /app/dist
      - type: bind
        source: ./k-tools
        target: /k-tools

  server:
    build:
      context: .
      dockerfile: Dockerserver
    ports:
      - "8000:8000"
    depends_on:
      - app
    command: sh -c "/wait && yarn server"
    volumes:
      - nodemodules:/app/node_modules
      - type: bind
        source: ./dist
        target: /app/dist
    environment:
      - WAIT_HOSTS=app:3001
      - WAIT_HOSTS_TIMEOUT=500
      - WAIT_SLEEP_INTERVAL=10
      - WAIT_HOST_CONNECT_TIMEOUT=10

volumes:
  nodemodules: {}