All skills
openai avatar

/cloudflare-deploy

@bf9e226 official
by openaiopenai/skills28k stars
1,891

Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.

Use this Skill: https://skilld.dev/gh/openai/skills/cloudflare-deploy

This session only. Nothing lands on disk.

referencescontainersconfiguration.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Wrangler Configuration

Basic Container Config

{
  "name": "my-worker",
  "main": "src/index.ts",
  "compatibility_date": "2026-01-10",
  "containers": [
    {
      "class_name": "MyContainer",
      "image": "./Dockerfile",  // Path to Dockerfile or directory with Dockerfile
      "instance_type": "standard-1",  // Predefined or custom (see below)
      "max_instances": 10
    }
  ],
  "durable_objects": {
    "bindings": [
      {
        "name": "MY_CONTAINER",
        "class_name": "MyContainer"
      }
    ]
  },
  "migrations": [
    {
      "tag": "v1",
      "new_sqlite_classes": ["MyContainer"]  // Must use new_sqlite_classes
    }
  ]
}

Key config requirements:

  • image - Path to Dockerfile or directory containing Dockerfile
  • class_name - Must match Container class export name
  • max_instances - Max concurrent container instances
  • Must configure Durable Objects binding AND migrations

Instance Types

Predefined Types
Type vCPU Memory Disk
lite 1/16 256 MiB 2 GB
basic 1/4 1 GiB 4 GB
standard-1 1/2 4 GiB 8 GB
standard-2 1 6 GiB 12 GB
standard-3 2 8 GiB 16 GB
standard-4 4 12 GiB 20 GB
{
  "containers": [
    {
      "class_name": "MyContainer",
      "image": "./Dockerfile",
      "instance_type": "standard-2"  // Use predefined type
    }
  ]
}
Custom Types (Jan 2026 Feature)
{
  "containers": [
    {
      "class_name": "MyContainer",
      "image": "./Dockerfile",
      "instance_type_custom": {
        "vcpu": 2,              // 1-4 vCPU
        "memory_mib": 8192,     // 512-12288 MiB (up to 12 GiB)
        "disk_mib": 16384       // 2048-20480 MiB (up to 20 GB)
      }
    }
  ]
}

Custom type constraints:

  • Minimum 3 GiB memory per vCPU
  • Maximum 2 GB disk per 1 GiB memory
  • Max 4 vCPU, 12 GiB memory, 20 GB disk per container

Account Limits

Resource Limit Notes
Total memory (all containers) 400 GiB Across all running containers
Total vCPU (all containers) 100 Across all running containers
Total disk (all containers) 2 TB Across all running containers
Image storage per account 50 GB Stored container images

Container Class Properties

import { Container } from "@cloudflare/containers";

export class MyContainer extends Container {
  // Port Configuration
  defaultPort = 8080;             // Default port for fetch() calls
  requiredPorts = [8080, 9090];   // Ports to wait for in startAndWaitForPorts()

  // Lifecycle
  sleepAfter = "30m";             // Inactivity timeout (5m, 30m, 2h, etc.)

  // Network
  enableInternet = true;          // Allow outbound internet access

  // Health Check
  pingEndpoint = "/health";       // Health check endpoint path

  // Environment
  envVars = {                     // Environment variables passed to container
    NODE_ENV: "production",
    LOG_LEVEL: "info"
  };

  // Startup
  entrypoint = ["/bin/start.sh"]; // Override image entrypoint (optional)
}

Property details:

  • defaultPort: Port used when calling container.fetch() without explicit port. Falls back to port 33 if not set.

  • requiredPorts: Array of ports that must be listening before startAndWaitForPorts() returns. First port becomes default if defaultPort not set.

  • sleepAfter: Duration string (e.g., "5m", "30m", "2h"). Container stops after this period of inactivity. Timer resets on each request.

  • enableInternet: Boolean. If true, container can make outbound HTTP/TCP requests.

  • pingEndpoint: Path used for health checks. Should respond with 2xx status.

  • envVars: Object of environment variables. Merged with runtime-provided vars (see below).

  • entrypoint: Array of strings. Overrides container image's CMD/ENTRYPOINT.

Runtime Environment Variables

Cloudflare automatically provides these environment variables to containers:

Variable Description
CLOUDFLARE_APPLICATION_ID Worker application ID
CLOUDFLARE_COUNTRY_A2 Two-letter country code of request origin
CLOUDFLARE_LOCATION Cloudflare data center location
CLOUDFLARE_REGION Region identifier
CLOUDFLARE_DURABLE_OBJECT_ID Container's Durable Object ID

Custom envVars from Container class are merged with these. Custom vars override runtime vars if names conflict.

Image Management

Distribution model: Images pre-fetched to all global locations before deployment. Ensures fast cold starts (2-3s typical).

Rolling deploys: Unlike Workers (instant), container deployments roll out gradually. Old versions continue running during rollout.

Ephemeral disk: Container disk is ephemeral and resets on each stop. Use Durable Object storage (this.ctx.storage) for persistence.

wrangler.toml Format

name = "my-worker"
main = "src/index.ts"
compatibility_date = "2026-01-10"

[[containers]]
class_name = "MyContainer"
image = "./Dockerfile"
instance_type = "standard-2"
max_instances = 10

[[durable_objects.bindings]]
name = "MY_CONTAINER"
class_name = "MyContainer"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["MyContainer"]

Both wrangler.jsonc and wrangler.toml are supported. Use wrangler.jsonc for comments and better IDE support.

Source: SKILL.md on GitHub

2 warnings17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides comprehensive guidance for deploying and managing infrastructure on the Cloudflare platform. It includes extensive educational material on secure development practices, such as preventing SQL injection and managing secrets effectively. No malicious patterns or security risks were identified.

  • Socket17d

    2 alerts: gptAnomaly

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    310/310 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at bf9e226. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Activeupdated 8 months ago

README badge

README badge for openai/skills/cloudflare-deploy

Deploys applications and infrastructure to Cloudflare's platform, including Workers, Pages, D1, R2, Durable Objects, KV, and other services. Use decision trees to route to the right Cloudflare product based on compute, storage, AI, networking, security, or media needs.

Generated from the current SKILL.md.

Does this skill cover all Cloudflare products?
The skill is a consolidated index covering compute, storage, AI, networking, security, media, and developer tools on Cloudflare. It uses decision trees to route you to the right product reference, then loads detailed guidance for that product.
What authentication is required before deploying?
Run `npx wrangler whoami` to check if authenticated. For local deployment, use `wrangler login` (one-time OAuth). For CI/CD, set the `CLOUDFLARE_API_TOKEN` environment variable.
What should I do if deployment fails due to network issues?
Rerun the deploy with `sandbox_permissions=require_escalated` to grant elevated network access, which is required for outbound requests to Cloudflare during deployment.
How long does a Cloudflare deployment typically take?
Deployments may take several minutes. Use appropriate timeout values in your configuration or CI/CD environment.

Generated from the current SKILL.md. These answers refresh after source changes.