mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(ci): build and push multi-arch Docker image (amd64 + arm64) (#6124)
Add QEMU cross-compilation and multi-arch manifest support so Apple Silicon (M1/M2/M3) and other ARM-based systems get native images. - Add docker/setup-qemu-action for arm64 emulation on amd64 runners - Smoke test stays amd64-only (load:true can't export multi-arch) - Both push steps (main + release) now build linux/amd64,linux/arm64 - Bump timeout 30->60min for QEMU cross-compilation overhead - Add permissions: contents: read (least-privilege hardening) Salvaged from PR #3998 by Mibayy. Also addresses #5005 and #3913. Co-authored-by: Mibayy <Mibayy@users.noreply.github.com>
This commit is contained in:
parent
7120d6cdd6
commit
18140199c3
1 changed files with 16 additions and 4 deletions
20
.github/workflows/docker-publish.yml
vendored
20
.github/workflows/docker-publish.yml
vendored
|
|
@ -8,6 +8,9 @@ on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: docker-${{ github.ref }}
|
group: docker-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
@ -17,22 +20,29 @@ jobs:
|
||||||
# Only run on the upstream repository, not on forks
|
# Only run on the upstream repository, not on forks
|
||||||
if: github.repository == 'NousResearch/hermes-agent'
|
if: github.repository == 'NousResearch/hermes-agent'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build image
|
# Build amd64 only so we can `load` the image for smoke testing.
|
||||||
|
# `load: true` cannot export a multi-arch manifest to the local daemon.
|
||||||
|
# The multi-arch build follows on push to main / release.
|
||||||
|
- name: Build image (amd64, smoke test)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
load: true
|
load: true
|
||||||
|
platforms: linux/amd64
|
||||||
tags: nousresearch/hermes-agent:test
|
tags: nousresearch/hermes-agent:test
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
@ -51,26 +61,28 @@ jobs:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Push image (main branch)
|
- name: Push multi-arch image (main branch)
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
push: true
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: |
|
||||||
nousresearch/hermes-agent:latest
|
nousresearch/hermes-agent:latest
|
||||||
nousresearch/hermes-agent:${{ github.sha }}
|
nousresearch/hermes-agent:${{ github.sha }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Push image (release)
|
- name: Push multi-arch image (release)
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
push: true
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: |
|
||||||
nousresearch/hermes-agent:latest
|
nousresearch/hermes-agent:latest
|
||||||
nousresearch/hermes-agent:${{ github.event.release.tag_name }}
|
nousresearch/hermes-agent:${{ github.event.release.tag_name }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue