Merge pull request #1091 from Molecule-AI/fix/tenant-canvas-cp-origin

fix(ci): bake api.moleculesai.app into tenant canvas bundle
This commit is contained in:
Hongming Wang 2026-04-20 12:51:28 -07:00 committed by GitHub
commit 40e524dea5

View File

@ -111,6 +111,21 @@ jobs:
${{ env.TENANT_IMAGE_NAME }}:staging-${{ steps.tags.outputs.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Bake the SaaS control-plane URL into the canvas bundle.
# Canvas's browser-side code uses PLATFORM_URL for every
# /cp/* call (auth, orgs, billing, terms). Leaving this empty
# made PLATFORM_URL fall back to http://localhost:8080 in the
# built bundle — which fails from the user's browser because
# localhost resolves to their own machine, not the tenant
# instance. Baking the CP origin here fixes browser-side auth
# for every tenant.
#
# Self-hosted / private-label deployments override this by
# rebuilding the image with a different NEXT_PUBLIC_PLATFORM_URL
# build-arg (e.g. https://api.their-domain.com). Same pattern
# molecule-app uses with NEXT_PUBLIC_CP_ORIGIN.
build-args: |
NEXT_PUBLIC_PLATFORM_URL=https://api.moleculesai.app
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}