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.
Prerequisites
Section titled “Prerequisites”- Cloudflare account with Workers Paid and Containers enabled
- Authenticated
wrangler(orCLOUDFLARE_API_TOKEN+CLOUDFLARE_ACCOUNT_IDfor non-interactive deploys)
One-command deploy (recommended)
Section titled “One-command deploy (recommended)”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:
offrig rig deploy edge --provider cloudflare --defaultCommon deploy options
Section titled “Common deploy options”# 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 Tokenoffrig 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 digestoffrig rig deploy edge --provider cloudflare --build-localLifecycle management
Section titled “Lifecycle management”Manage your deployed Gateway directly from offrig:
# Upgrade the Gateway to match your installed offrig CLI versionoffrig rig upgrade edge
# Rotate the Gateway Bearer token with edge-convergence verificationoffrig rig rotate-token edge
# Tear down both the Cloudflare Worker AND the Container application, then unregister the Rigoffrig rig destroy edge --yesConnecting to an existing Gateway
Section titled “Connecting to an existing Gateway”If another teammate deployed the Gateway, register it with offrig rig add:
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 edgeSizing, idle defaults, and platform limits
Section titled “Sizing, idle defaults, and platform limits”- Default sizing: Unspecified
[resources]defaults to Cloudflarestandard-3(2 vCPU,8192 MiBRAM,16384 MiBdisk). Configure independently within1..=4vCPU,256..=12288MiB RAM, and2048..=20480MiB disk (default_disk_mib). - Idle timeout: Defaults to
2minutes (idle_minutes = 2) to bound container memory and Durable Object duration billing. On idle stop after a Run, the Gateway runsoffrigd secret-scan, captures a Layer-2 snapshot, and destroys the active container. - Custom images:
[env].imageand[env].dockerfileare not supported dynamically on Cloudflare Containers because a deployed Container class binds to one base image. Use[env].packages,mise.toml, and[env].setupinstead. - Nested Docker (
run.docker = "dind"): Supported inside the curated image with--network=hostfor 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.