Skip to content

Cloudflare Containers

The cloudflare Provider connects offrig to a self-hosted Cloudflare Gateway (Cloudflare Worker + Durable Objects + Cloudflare Containers) running inside your own Cloudflare account—zero third-party offrig servers, zero manual repo cloning required.

  • Cloudflare account with Workers Paid and Containers enabled
  • Authenticated wrangler (or CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID for non-interactive deploys)

Deploy the embedded Cloudflare Gateway Worker, Durable Objects, curated Ubuntu 24.04 container image, strong generated Bearer token, and local Rig registration in a single command:

Terminal window
offrig rig deploy edge --provider cloudflare --default
Terminal window
# Attach a custom domain (disables workers.dev)
offrig rig deploy edge --provider cloudflare \
--custom-domain gw.example.com \
--default
# Front with Cloudflare Access (Zero Trust) Service Token
offrig rig deploy edge --provider cloudflare \
--custom-domain gw.example.com \
--cf-access-client-id-env CF_ACCESS_CLIENT_ID \
--cf-access-client-secret-env CF_ACCESS_CLIENT_SECRET
# Build the embedded base image locally with Docker instead of pulling the prebuilt digest
offrig rig deploy edge --provider cloudflare --build-local

Manage your deployed Gateway directly from offrig:

Terminal window
# Upgrade the Gateway to match your installed offrig CLI version
offrig rig upgrade edge
# Rotate the Gateway Bearer token with edge-convergence verification
offrig rig rotate-token edge
# Tear down both the Cloudflare Worker AND the Container application, then unregister the Rig
offrig rig destroy edge --yes

If another teammate deployed the Gateway, register it with offrig rig add:

Terminal window
export OFFRIG_CLOUDFLARE_TOKEN="<gateway bearer token>"
offrig rig add edge --provider cloudflare \
--url "https://offrig-gw-edge.<subdomain>.workers.dev" \
--token-env OFFRIG_CLOUDFLARE_TOKEN \
--default
offrig rig doctor edge

Sizing, idle defaults, and platform limits

Section titled “Sizing, idle defaults, and platform limits”
  • Default sizing: Unspecified [resources] defaults to Cloudflare standard-3 (2 vCPU, 8192 MiB RAM, 16384 MiB disk). Configure independently within 1..=4 vCPU, 256..=12288 MiB RAM, and 2048..=20480 MiB disk (default_disk_mib).
  • Idle timeout: Defaults to 2 minutes (idle_minutes = 2) to bound container memory and Durable Object duration billing. On idle stop after a Run, the Gateway runs offrigd secret-scan, captures a Layer-2 snapshot, and destroys the active container.
  • Custom images: [env].image and [env].dockerfile are not supported dynamically on Cloudflare Containers because a deployed Container class binds to one base image. Use [env].packages, mise.toml, and [env].setup instead.
  • Nested Docker (run.docker = "dind"): Supported inside the curated image with --network=host for outbound internet access. run.docker = "host" is unsupported.
  • Rolling snapshot lifetime: Snapshots age out after 29 days of inactivity (MAX(created_at, last_restored_at)) or when the Gateway’s base image digest changes.