Skip to content

Commit ecaafa9

Browse files
Remove multi-arch Docker image support (#245)
* Remove multi-arch Docker image support Production only supports linux/amd64. Publishing ARM64 images caused Docker to automatically select the ARM variant on ARM hosts, creating dev/prod architecture mismatch and potential platform-specific bugs. ARM Mac users will use emulation automatically, ensuring local dev matches production deployment. * Fix pre-commit hook for package.json files Remove json from biome-fix glob since biome ignores package.json files. Prettier in the format command already handles JSON formatting. * Fix base images in examples * Add Docker setup guide link to README Link to official docs setup guide in prerequisites for Docker installation and troubleshooting.
1 parent 3282740 commit ecaafa9

File tree

13 files changed

+17
-58
lines changed

13 files changed

+17
-58
lines changed

.changeset/remove-multi-arch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudflare/sandbox': patch
3+
---
4+
5+
Publish Docker images for linux/amd64 only to ensure dev/prod parity. ARM Mac users will automatically use emulation, matching production deployment behavior. This prevents architecture-specific bugs caused by Docker automatically selecting ARM64 variants on ARM hosts.

.github/workflows/pkg-pr-new.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,11 @@ jobs:
8282
with:
8383
context: .
8484
file: packages/sandbox/Dockerfile
85-
platforms: linux/amd64,linux/arm64
85+
platforms: linux/amd64
8686
push: true
8787
tags: cloudflare/sandbox:${{ steps.package-version.outputs.version }}
8888
cache-from: |
8989
type=gha,scope=preview-pr-${{ github.event.pull_request.number }}
90-
type=gha,scope=pr-${{ github.event.pull_request.number }}-amd64
91-
type=gha,scope=release-amd64
9290
type=gha,scope=release
9391
cache-to: type=gha,mode=max,scope=preview-pr-${{ github.event.pull_request.number }}
9492
build-args: |

.github/workflows/release.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,29 +177,15 @@ jobs:
177177
username: ${{ secrets.DOCKER_HUB_USERNAME }}
178178
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
179179

180-
- name: Build and cache single-arch image (for PR cache reuse)
181-
uses: docker/build-push-action@v6
182-
with:
183-
context: .
184-
file: packages/sandbox/Dockerfile
185-
platforms: linux/amd64
186-
push: false # Don't push, just cache
187-
cache-from: type=gha,scope=release-amd64
188-
cache-to: type=gha,mode=max,scope=release-amd64
189-
build-args: |
190-
SANDBOX_VERSION=${{ needs.unit-tests.outputs.version }}
191-
192180
- name: Build and push Docker image
193181
uses: docker/build-push-action@v6
194182
with:
195183
context: .
196184
file: packages/sandbox/Dockerfile
197-
platforms: linux/amd64,linux/arm64
185+
platforms: linux/amd64
198186
push: true
199187
tags: cloudflare/sandbox:${{ needs.unit-tests.outputs.version }}
200-
cache-from: |
201-
type=gha,scope=release-amd64
202-
type=gha,scope=release
188+
cache-from: type=gha,scope=release
203189
cache-to: type=gha,mode=max,scope=release
204190
build-args: |
205191
SANDBOX_VERSION=${{ needs.unit-tests.outputs.version }}

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,10 @@ Note: Container isolation is handled at the Cloudflare platform level (VMs), not
385385
- **Beta releases**: Published automatically on every push to main (`@beta` tag on npm)
386386
- **Stable releases**: When changesets exist, the "Version Packages" PR is auto-created. Merging it triggers:
387387
1. Version bump in `package.json`
388-
2. Docker image build and push to Docker Hub (multi-arch: amd64, arm64)
388+
2. Docker image build and push to Docker Hub (linux/amd64 architecture only to match production)
389389
3. npm package publish with updated version
390390
- **Version synchronization**: Docker image version always matches npm package version (enforced via `ARG SANDBOX_VERSION` in Dockerfile)
391+
- **Architecture**: Images are built for linux/amd64 only, matching Cloudflare's production container runtime. ARM Mac users will automatically use emulation (Rosetta/QEMU) for local development, ensuring perfect dev/prod parity.
391392

392393
**SDK version tracked in**: `packages/sandbox/src/version.ts`
393394

examples/claude-code/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@ FROM docker.io/cloudflare/sandbox:0.5.4
22
RUN npm install -g @anthropic-ai/claude-code
33
ENV COMMAND_TIMEOUT_MS=300000
44
EXPOSE 3000
5-
6-
# On a Mac with Apple Silicon, you might need to specify the platform:
7-
# FROM --platform=linux/arm64 docker.io/cloudflare/sandbox:0.5.4
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
# This image is unique to this repo, and you'll never need it.
2-
# Whenever you're integrating with sandbox SDK in your own project,
3-
# you should use the official image instead:
4-
# FROM docker.io/cloudflare/sandbox:0.5.4
5-
FROM cloudflare/sandbox-test:0.5.4
6-
7-
# On a mac, you might need to actively pick up the
8-
# arm64 build of the image.
9-
# FROM --platform=linux/arm64 cloudflare/sandbox-test:0.5.4
1+
FROM docker.io/cloudflare/sandbox:0.5.4

examples/minimal/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
FROM docker.io/cloudflare/sandbox:0.5.4
22

3-
# On a Mac with Apple Silicon, you might need to specify the platform:
4-
# FROM --platform=linux/arm64 docker.io/cloudflare/sandbox:0.5.4
5-
63
# Required during local development to access exposed ports
74
EXPOSE 8080

examples/openai-agents/Dockerfile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# This image is unique to this repo, and you'll never need it.
2-
# Whenever you're integrating with sandbox SDK in your own project,
3-
# you should use the official image instead:
4-
# FROM docker.io/cloudflare/sandbox:0.5.4
5-
# FROM cloudflare/sandbox-test:0.5.4
6-
7-
# On a mac, you might need to actively pick up the
8-
# arm64 build of the image.
9-
FROM --platform=linux/arm64 cloudflare/sandbox-test:0.5.4
1+
FROM docker.io/cloudflare/sandbox:0.5.4
102

113
# Required during local development to access exposed ports
124
EXPOSE 8080

examples/typescript-validator/Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# Use Cloudflare sandbox as base
22
FROM docker.io/cloudflare/sandbox:0.5.4
33

4-
# On a mac, you might need to actively pick up the
5-
# arm64 build of the image.
6-
# FROM --platform=linux/arm64 cloudflare/sandbox-test:0.5.4
7-
8-
94
# Install esbuild for TypeScript bundling
105
RUN npm install -g esbuild
116

lefthook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pre-commit:
55
commands:
66
biome-fix:
7-
glob: '{packages,examples,sites}/**/*.{js,ts,tsx,json,astro}'
7+
glob: '{packages,examples,sites}/**/*.{js,ts,tsx,astro}'
88
run: npx biome check --write {staged_files}
99
stage_fixed: true
1010

0 commit comments

Comments
 (0)