How Defang deploys to GCP

Your Docker Compose file is the only config you need. Three steps to production.

1

Start with your Docker Compose file

The same Docker Compose file you use with `docker compose up` locally. Add optional annotations for managed cloud services.

services:
  web:
    build: .
    ports:
      - "8080:8080"
    environment:
      - DATABASE_URL=postgres://db:5432/myapp

  db:
    x-defang-postgres: true
2

Run defang compose up

Defang reads your compose file, builds your images with Cloud Build, and provisions all necessary GCP infrastructure.

$ defang compose up --provider=gcp

 * Uploading build context for web
 * Deploying service web
 * Tailing logs for deployment ID a1b2c3d4 ; press Ctrl+C to detach:
2026-02-19T10:00:01Z cd Update started
2026-02-19T10:00:12Z cd Update succeeded in 11.2s ; provisioning...
2026-02-19T10:00:45Z web Listening on port 8080

 * Done.
3

Your app is live on GCP

Defang creates a complete Cloud Run deployment with automatic scaling, load balancing, and managed databases — all in your GCP project.

$ defang services

SERVICE  DEPLOYMENT  STATE                  ENDPOINT
web      a1b2c3d4    DEPLOYMENT_COMPLETED   https://myapp-web--8080.prod1.defang.dev
db       a1b2c3d4    DEPLOYMENT_COMPLETED   N/A

What Defang creates in your GCP project

All provisioned automatically from your Docker Compose file, following GCP best practices.

Compute

Cloud Run

Serverless containers that scale from zero to thousands. Pay only for actual request time.

Build

Cloud Build

Builds your Docker images in GCP. No local builds needed, no Docker Hub required.

Registry

Artifact Registry

Secure container registry for your Docker images, integrated with Cloud Run.

Database

Cloud SQL

Managed PostgreSQL with automatic backups, encryption, and high availability.

Caching

Memorystore

Managed Redis for caching and session storage with sub-millisecond latency.

AI/ML

Vertex AI

Access Gemini and other LLMs through Vertex AI. Add x-defang-llm: true to your compose file.

NoSQL

Firestore

Managed MongoDB-compatible database via Firestore. Add x-defang-mongodb: true for automatic provisioning.

Environments

Named Stacks

Deploy dev, staging, and production from the same compose file with isolated named stacks.

Security

SOC 2 Certified

SOC 2 certified. Least-privilege IAM, encrypted secrets, and isolated VPC networking by default.

Your Docker Compose file, enhanced for the cloud

Standard Docker Compose syntax plus optional annotations. Run locally with docker compose up. Deploy to GCP with defang compose up.

compose.yaml
services:
  web:
    build: .
    ports:
      - "8080:8080"
    environment:
      - DATABASE_URL
      - REDIS_URL
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M

  # Managed PostgreSQL via Cloud SQL
  db:
    x-defang-postgres: true

  # Managed Redis via Memorystore
  cache:
    x-defang-redis: true

  # Managed MongoDB via Firestore
  nosql:
    image: mongo:5
    x-defang-mongodb: true
    environment:
      - MONGO_INITDB_DATABASE=mydb

  # Managed LLM via Vertex AI
  ai:
    build: ./ai-service
    x-defang-llm: true

  # Background worker
  worker:
    build: .
    command: ["node", "worker.js"]
    deploy:
      replicas: 2

Deploy with: defang compose up --provider=gcp