networks:
  dokploy-network:
    external: true

services:
  temporal:
    container_name: temporal
    image: temporalio/auto-setup:1.24.2
    environment:
      - DB=postgres12
      - DB_PORT=5432
      - POSTGRES_USER=postgres
      - POSTGRES_PWD=${TEMPORAL_DB_PASSWORD}
      - POSTGRES_SEEDS=${TEMPORAL_DB_HOST}
      - TEMPORAL_ADDRESS=temporal:7233
      - TEMPORAL_CLI_ADDRESS=temporal:7233
    networks:
      dokploy-network:
        aliases:
          - temporal
    expose:
      - "7233"

  temporal-admin-tools:
    container_name: temporal-admin-tools
    depends_on:
      - temporal
    image: temporalio/admin-tools:latest
    environment:
      - TEMPORAL_ADDRESS=temporal:7233
      - TEMPORAL_CLI_ADDRESS=temporal:7233
    networks:
      dokploy-network:
        aliases:
          - temporal-admin-tools
    stdin_open: true
    tty: true

  temporal-ui:
    container_name: temporal-ui
    depends_on:
      - temporal
    image: temporalio/ui:2.26.2
    environment:
      - TEMPORAL_ADDRESS=temporal:7233
      - TEMPORAL_CORS_ORIGINS=http://localhost:3000
    networks:
      dokploy-network:
        aliases:
          - temporal-ui
    expose:
      - "8080"

  platform-worker:
    container_name: platform-worker
    build:
      context: .
      dockerfile: platform_worker/Dockerfile
    depends_on:
      - temporal
    environment:
      - TEMPORAL_HOST=temporal:7233
      - TEMPORAL_NAMESPACE=default
      - TASK_QUEUE=platform-worker
      - INFISICAL_API_URL=${INFISICAL_API_URL}
      - INFISICAL_CLIENT_ID=${INFISICAL_CLIENT_ID}
      - INFISICAL_CLIENT_SECRET=${INFISICAL_CLIENT_SECRET}
      - INFISICAL_PROJECT_ID=${INFISICAL_PROJECT_ID}
      - INFISICAL_ENV=${INFISICAL_ENV:-prod}
    networks:
      dokploy-network:
        aliases:
          - platform-worker
    restart: unless-stopped
