Deploy to Cloud Run

One Command Deploy

Example

Cloud Run builds the image from source, stores it in Artifact Registry and serves it over HTTPS with autoscaling:

gcloud run deploy course-api \
  --source . \
  --region asia-south1 \
  --allow-unauthenticated \
  --set-env-vars ENV=production \
  --set-secrets JWT_SECRET=jwt-secret:latest

Example output

Building using Dockerfile and deploying container to Cloud Run service [course-api]
✓ Building and deploying... Done.
  ✓ Uploading sources...
  ✓ Building Container...
  ✓ Creating Revision...
  ✓ Routing traffic...
Service [course-api] revision [course-api-00001-abc] has been deployed and is serving 100 percent of traffic.
Service URL: https://course-api-abc123-el.a.run.app

Tip: The GCP crash course covers Cloud Run, Cloud SQL and Secret Manager in more depth.