Skip to main content

Deployment

The app deploys to Azure Container Apps via Docker. A Makefile at the repo root wraps the full release pipeline.

Prerequisites​

  • Docker
  • Azure CLI (az) logged in: az login
  • Values set in .env.make.local (infra vars) and next-app/.env (app vars)

Makefile Commands​

CommandWhat it does
make builddocker build the Next.js app
make pushLog in to ACR and push the image
make env-setPush all app env vars from next-app/.env to the Container App
make deployRun env-set then update the Container App image
make releasebuild → push → deploy (full release in one shot)

make deploy always calls make env-set first — env vars are never out of sync with the deployed image.

Configuration​

.env.make.local — Infrastructure vars​

Create this file at the repo root (gitignored). It is never committed.

REGISTRY=yourregistry.azurecr.io
RESOURCE_GROUP=your-resource-group
CONTAINERAPP_NAME=ca-tailormade
CONTAINERAPP_ENV=your-container-app-env

Optional overrides:

IMAGE_NAME=tailormade          # default
IMAGE_TAG= # default: git short SHA

next-app/.env — App vars​

This is the single source of truth for all application environment variables — used for both local dev (npm run dev) and production deployment (make env-set).

See Installation → Environment Variables for the full reference.

First-Time Setup​

If creating the Container App from scratch:

make build
make push
make create # az containerapp create (run once)
make env-set # push env vars

make create provisions the Container App with external ingress on port 8080 and a minimum of 1 replica.

Google Credentials in Production​

Azure Container Apps does not provide Application Default Credentials automatically (unlike Cloud Run). Pass a base64-encoded service account JSON:

# Encode the key file
B64=$(base64 -w0 /path/to/sa-key.json)

Add to next-app/.env:

GOOGLE_APPLICATION_CREDENTIALS_B64=<base64-encoded JSON>

Then run make env-set. The Docker entrypoint (docker-entrypoint.sh) decodes this at container startup and sets GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcp-credentials.json.

The service account needs roles/aiplatform.user on premi1078276-inventglobalai.

Database Migrations​

Migrations run automatically at container startup via prisma migrate deploy in the entrypoint. No manual step needed on deploy.

To run them manually (e.g. from a local machine against the production DB):

cd next-app
DATABASE_URL="postgresql://..." npm run prisma:deploy

Docs Deployment​

The documentation site (this site) deploys to Azure Static Web Apps.

make docs-build      # build the Docusaurus static site into docs/build/
make docs-deploy # upload to Azure Static Web Apps

Requires in .env.make.local:

DOCS_DEPLOY_TOKEN=<deployment token from Azure Portal>

Get the token from Azure Portal → Static Web Apps → your app → Manage deployment token.