Skip to content

Build OpenClaw Image #122

Build OpenClaw Image

Build OpenClaw Image #122

name: Build OpenClaw Image
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
openclawTag:
default: "2026.6.8"
description: "OpenClaw release and Docker Hub tag, for example 2026.6.8"
required: true
pushLatest:
description: "Push latest tag"
default: "true"
required: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
IMAGE_NAME: 1panel/openclaw
jobs:
resolve:
runs-on: ubuntu-24.04
outputs:
openclaw_tag: ${{ steps.meta.outputs.openclaw_tag }}
dockerhub_tag: ${{ steps.meta.outputs.dockerhub_tag }}
push_latest: ${{ steps.meta.outputs.push_latest }}
steps:
- name: Resolve release metadata
id: meta
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_OPENCLAW_TAG: ${{ github.event.inputs.openclawTag }}
INPUT_PUSH_LATEST: ${{ github.event.inputs.pushLatest }}
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
openclaw_tag="${INPUT_OPENCLAW_TAG}"
push_latest="${INPUT_PUSH_LATEST:-true}"
else
openclaw_tag="${REF_NAME#v}"
push_latest="true"
fi
if [ -z "$openclaw_tag" ]; then
echo "::error::Failed to resolve OpenClaw tag"
exit 1
fi
{
echo "openclaw_tag=$openclaw_tag"
echo "dockerhub_tag=$openclaw_tag"
echo "push_latest=$push_latest"
} >> "$GITHUB_OUTPUT"
build-amd64:
needs: resolve
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download Source
run: |
set -euo pipefail
mkdir -p _src/openclaw
curl -fsSL "https://github.com/openclaw/openclaw/archive/refs/tags/v${{ needs.resolve.outputs.openclaw_tag }}.tar.gz" \
| tar -xz -C _src/openclaw --strip-components=1
test -d _src/openclaw/packages || { echo "::error::OpenClaw source is missing packages/. Check openclawTag matches this Dockerfile."; exit 1; }
test -f _src/openclaw/scripts/prune-docker-plugin-dist.mjs || { echo "::error::OpenClaw source is missing scripts/prune-docker-plugin-dist.mjs. Check openclawTag matches this Dockerfile."; exit 1; }
test -d _src/openclaw/extensions/canvas/src/host || { echo "::error::OpenClaw source is missing extensions/canvas/src/host/. Check openclawTag matches this Dockerfile."; exit 1; }
mkdir -p _src/openclaw/openclaw
cp openclaw/Dockerfile openclaw/docker-entrypoint.sh _src/openclaw/openclaw/
- name: Build and push amd64 image
uses: docker/build-push-action@v7
with:
context: _src/openclaw
file: _src/openclaw/openclaw/Dockerfile
platforms: linux/amd64
push: true
build-args: |
OPENCLAW_INSTALL_BROWSER=true
tags: |
${{ env.IMAGE_NAME }}:${{ needs.resolve.outputs.dockerhub_tag }}-amd64
cache-from: type=gha,scope=openclaw-amd64
cache-to: type=gha,mode=max,scope=openclaw-amd64
build-arm64:
needs: resolve
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download Source
run: |
set -euo pipefail
mkdir -p _src/openclaw
curl -fsSL "https://github.com/openclaw/openclaw/archive/refs/tags/v${{ needs.resolve.outputs.openclaw_tag }}.tar.gz" \
| tar -xz -C _src/openclaw --strip-components=1
test -d _src/openclaw/packages || { echo "::error::OpenClaw source is missing packages/. Check openclawTag matches this Dockerfile."; exit 1; }
test -f _src/openclaw/scripts/prune-docker-plugin-dist.mjs || { echo "::error::OpenClaw source is missing scripts/prune-docker-plugin-dist.mjs. Check openclawTag matches this Dockerfile."; exit 1; }
test -d _src/openclaw/extensions/canvas/src/host || { echo "::error::OpenClaw source is missing extensions/canvas/src/host/. Check openclawTag matches this Dockerfile."; exit 1; }
mkdir -p _src/openclaw/openclaw
cp openclaw/Dockerfile openclaw/docker-entrypoint.sh _src/openclaw/openclaw/
- name: Build and push arm64 image
uses: docker/build-push-action@v7
with:
context: _src/openclaw
file: _src/openclaw/openclaw/Dockerfile
platforms: linux/arm64
push: true
build-args: |
OPENCLAW_INSTALL_BROWSER=true
tags: |
${{ env.IMAGE_NAME }}:${{ needs.resolve.outputs.dockerhub_tag }}-arm64
cache-from: type=gha,scope=openclaw-arm64
cache-to: type=gha,mode=max,scope=openclaw-arm64
create-manifest:
needs: [resolve, build-amd64, build-arm64]
runs-on: ubuntu-24.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Create and push multi-platform manifest
shell: bash
env:
IMAGE: ${{ env.IMAGE_NAME }}
TAG: ${{ needs.resolve.outputs.dockerhub_tag }}
PUSH_LATEST: ${{ needs.resolve.outputs.push_latest }}
run: |
set -euo pipefail
docker buildx imagetools create \
-t "${IMAGE}:${TAG}" \
"${IMAGE}:${TAG}-amd64" \
"${IMAGE}:${TAG}-arm64"
if [ "$PUSH_LATEST" = "true" ]; then
docker buildx imagetools create \
-t "${IMAGE}:latest" \
"${IMAGE}:${TAG}-amd64" \
"${IMAGE}:${TAG}-arm64"
fi