mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-03 08:06:01 +08:00
Publish ironclaw-worker image from Dockerfile.worker (#1979)
* feat(docker): publish ironclaw-worker image alongside ironclaw Build and push nearaidev/ironclaw-worker from Dockerfile.worker in the same workflow. Both images share the same version/sha/tag scheme. This lets ironclaw-dind pull the pre-built worker image for sandbox baking instead of cloning the repo and building from source. [skip-regression-check] * feat(docker): daily scheduled build of :staging from staging branch * perf(docker): worker image copies binary from ironclaw image instead of rebuilding * revert Dockerfile.worker changes, keep it building from source
This commit is contained in:
41
.github/workflows/docker.yml
vendored
41
.github/workflows/docker.yml
vendored
@@ -17,9 +17,13 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
# Daily staging build from the staging branch
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
|
||||
env:
|
||||
IMAGE_NAME: nearaidev/ironclaw
|
||||
WORKER_IMAGE_NAME: nearaidev/ironclaw-worker
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -32,6 +36,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'schedule' && 'staging' || '' }}
|
||||
|
||||
- name: Extract version from Cargo.toml
|
||||
id: version
|
||||
@@ -45,22 +51,35 @@ jobs:
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
SHA="sha-${GITHUB_SHA::7}"
|
||||
echo "sha_tag=${SHA}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [[ "${{ github.event_name }}" == "workflow_call" ]]; then
|
||||
# Release: :version + :latest + :sha-xxx
|
||||
TAGS="${{ env.IMAGE_NAME }}:${VERSION}"
|
||||
TAGS="${TAGS},${{ env.IMAGE_NAME }}:latest"
|
||||
TAGS="${TAGS},${{ env.IMAGE_NAME }}:${SHA}"
|
||||
WORKER_TAGS="${{ env.WORKER_IMAGE_NAME }}:${VERSION}"
|
||||
WORKER_TAGS="${WORKER_TAGS},${{ env.WORKER_IMAGE_NAME }}:latest"
|
||||
WORKER_TAGS="${WORKER_TAGS},${{ env.WORKER_IMAGE_NAME }}:${SHA}"
|
||||
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
|
||||
# Daily staging: :staging + :sha-xxx
|
||||
TAGS="${{ env.IMAGE_NAME }}:staging"
|
||||
TAGS="${TAGS},${{ env.IMAGE_NAME }}:${SHA}"
|
||||
WORKER_TAGS="${{ env.WORKER_IMAGE_NAME }}:staging"
|
||||
WORKER_TAGS="${WORKER_TAGS},${{ env.WORKER_IMAGE_NAME }}:${SHA}"
|
||||
else
|
||||
# Manual dispatch: :sha-xxx only
|
||||
TAGS="${{ env.IMAGE_NAME }}:${SHA}"
|
||||
WORKER_TAGS="${{ env.WORKER_IMAGE_NAME }}:${SHA}"
|
||||
fi
|
||||
|
||||
# Manual override adds an extra tag (e.g. "staging")
|
||||
if [[ -n "${{ inputs.tag }}" ]]; then
|
||||
TAGS="${TAGS},${{ env.IMAGE_NAME }}:${{ inputs.tag }}"
|
||||
WORKER_TAGS="${WORKER_TAGS},${{ env.WORKER_IMAGE_NAME }}:${{ inputs.tag }}"
|
||||
fi
|
||||
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
|
||||
echo "worker_tags=${WORKER_TAGS}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@@ -71,7 +90,7 @@ jobs:
|
||||
username: ${{ vars.DOCKER_REGISTRY_USER }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push (ironclaw)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
@@ -81,16 +100,32 @@ jobs:
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build and push (ironclaw-worker)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.worker
|
||||
push: true
|
||||
tags: ${{ steps.tags.outputs.worker_tags }}
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha,scope=worker
|
||||
cache-to: type=gha,mode=max,scope=worker
|
||||
|
||||
- name: Summary
|
||||
run: |
|
||||
{
|
||||
echo "## Docker Image"
|
||||
echo "## Docker Images"
|
||||
echo ""
|
||||
echo "**Tags pushed:**"
|
||||
echo "**ironclaw:**"
|
||||
echo '```'
|
||||
echo "${{ steps.tags.outputs.tags }}" | tr ',' '\n'
|
||||
echo '```'
|
||||
echo ""
|
||||
echo "**ironclaw-worker:**"
|
||||
echo '```'
|
||||
echo "${{ steps.tags.outputs.worker_tags }}" | tr ',' '\n'
|
||||
echo '```'
|
||||
echo ""
|
||||
echo "- version: \`${{ steps.version.outputs.version }}\`"
|
||||
echo "- sha: \`${GITHUB_SHA::7}\`"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
Reference in New Issue
Block a user