version: '3.9'
services:
  typebot_db:
    image: postgres:13
    restart: always
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=typebot
      - POSTGRES_PASSWORD=typebot
  typebot_builder:
    depends_on:
      - typebot_db
    build:
      context: .
      args:
        - SCOPE=builder
    ports:
      - '8080:3000'
    env_file:
      - typebot-config.env
    entrypoint: >
      /bin/sh -c "
      sleep 10;
      npx prisma migrate deploy;
      node server.js;"
  typebot_viewer:
    depends_on:
      - typebot_db
    restart: always
    build:
      context: .
      args:
        - SCOPE=viewer
    ports:
      - '8081:3000'
    env_file:
      - typebot-config.env
volumes:
  db_data:
  s3_data:
