diff options
| author | Felipe Oduardo Sierra <[email protected]> | 2025-12-13 20:01:59 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-13 13:01:59 -0600 |
| commit | f254cf76d919a96559706c92fa5af009ce699d63 (patch) | |
| tree | fd39cc610d76703b75fbe916d35ccc32be90ad7d | |
| parent | b4ffaa21ec0576936fa24c72d6548bba6bdd9239 (diff) | |
| download | opencode-f254cf76d919a96559706c92fa5af009ce699d63.tar.gz opencode-f254cf76d919a96559706c92fa5af009ce699d63.zip | |
add ARM64 Docker image support (#5483)
| -rw-r--r-- | .github/workflows/publish.yml | 6 | ||||
| -rw-r--r-- | packages/opencode/Dockerfile | 12 | ||||
| -rwxr-xr-x | packages/opencode/script/publish.ts | 8 |
3 files changed, 20 insertions, 6 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96b9280fb..9c44efe1b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -64,6 +64,12 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - uses: actions/setup-node@v4 with: node-version: "24" diff --git a/packages/opencode/Dockerfile b/packages/opencode/Dockerfile index 99f593581..f92b48a6d 100644 --- a/packages/opencode/Dockerfile +++ b/packages/opencode/Dockerfile @@ -1,10 +1,18 @@ -FROM alpine +FROM alpine AS base # Disable the runtime transpiler cache by default inside Docker containers. # On ephemeral containers, the cache is not useful ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0 ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH} RUN apk add libgcc libstdc++ ripgrep -ADD ./dist/opencode-linux-x64-baseline-musl/bin/opencode /usr/local/bin/opencode + +FROM base AS build-amd64 +COPY dist/opencode-linux-x64-baseline-musl/bin/opencode /usr/local/bin/opencode + +FROM base AS build-arm64 +COPY dist/opencode-linux-arm64-musl/bin/opencode /usr/local/bin/opencode + +ARG TARGETARCH +FROM build-${TARGETARCH} RUN opencode --version ENTRYPOINT ["opencode"] diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index ff75bbb8d..72632992f 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -244,8 +244,8 @@ if (!Script.preview) { await $`cd ./dist/homebrew-tap && git push` const image = "ghcr.io/sst/opencode" - await $`docker build -t ${image}:${Script.version} .` - await $`docker push ${image}:${Script.version}` - await $`docker tag ${image}:${Script.version} ${image}:latest` - await $`docker push ${image}:latest` + const platforms = "linux/amd64,linux/arm64" + const tags = [`${image}:${Script.version}`, `${image}:latest`] + const tagFlags = tags.flatMap((t) => ["-t", t]) + await $`docker buildx build --platform ${platforms} ${tagFlags} --push .` } |
