x-global-vars: &common-global-variables
  TZ: Etc/UTC

x-bridge-vars: &common-bridge-variables
  DATABASE_HOST: "bridge-postgresql"
  DATABASE_NAME: "bridge"
  DATABASE_ROOT_OWNER: "root"
  DATABASE_ROOT_PASSWORD: ${BRIDGE_DATABASE_ROOT_PASSWORD}
  DATABASE_OWNER: "bridge"
  DATABASE_PASSWORD: ${BRIDGE_DATABASE_PASSWORD}
  DATABASE_URL: "postgresql://bridge:${BRIDGE_DATABASE_PASSWORD}@bridge-postgresql/bridge"
  WORKER_DATABASE_URL: "postgresql://bridge:${BRIDGE_DATABASE_PASSWORD}@bridge-postgresql/bridge"
  SHADOW_DATABASE_URL: "postgresql://bridge:${BRIDGE_DATABASE_PASSWORD}@bridge-postgresql/bridge_shadow"
  ROOT_DATABASE_URL: "postgresql://bridge:${BRIDGE_DATABASE_PASSWORD}@bridge-postgresql/template1"
  APP_ROOT_DATABASE_URL: "postgresql://root:${BRIDGE_DATABASE_ROOT_PASSWORD}@bridge-postgresql/bridge"
  DATABASE_AUTH_URL: "postgresql://app_graphile_auth:${BRIDGE_DATABASE_AUTHENTICATOR_PASSWORD}@bridge-postgresql/bridge"
  FRONTEND_URL: ${BRIDGE_DOMAIN}
  API_URL: "http://bridge-api:3001"
  NEXTAUTH_URL: ${BRIDGE_DOMAIN}
  NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}

services:
  bridge-frontend:
    build:
      context: ../../
      dockerfile: ./apps/bridge-frontend/Dockerfile
    container_name: bridge-frontend
    restart: ${RESTART}
    ports:
      - 8006:3000
    environment: *common-bridge-variables

  bridge-worker:
    build:
      context: ../../
      dockerfile: ./apps/bridge-worker/Dockerfile
    container_name: bridge-worker
    restart: ${RESTART}
    environment: *common-bridge-variables
