Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(release): reuse amd64 binary for docker image
AkitaOnRails45464a39d735
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex a3747fef..32af43fb 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -3,7 +3,9 @@ name: release# Triggered when a version tag is pushed, e.g. git push origin v0.3.2.# Builds the native Linux release tarball, creates the GitHub Release,# and pushes the Docker image to Docker Hub with both the version tag-# and `latest` when Docker Hub credentials are configured.+# and `latest` when Docker Hub credentials are configured. The amd64+# image reuses the native release artifact; arm64 still builds through+# Docker/QEMU so the published ARM image is exercised in GitHub infra.## Optional publish secrets (set in repo Settings → Secrets and variables → Actions):# DOCKERHUB_USERNAME — Docker Hub account name@@ -133,8 +135,69 @@ jobs:echo "::warning::AUR_SSH_PRIVATE_KEY not set — skipping AUR publish."fi- docker:- name: docker build + push+ docker-amd64:+ name: docker amd64 image+ needs: [binary, check-secrets, validate-version]+ if: needs.check-secrets.outputs.docker_enabled == 'true'+ runs-on: ubuntu-latest+ permissions:+ contents: read+ packages: write+ steps:+ - uses: actions/checkout@v4++ - uses: actions/download-artifact@v4+ with:+ name: ai-memory-linux-x86_64+ path: artifacts++ - name: Unpack prebuilt amd64 binary+ run: |+ set -euo pipefail+ mkdir -p dist/docker/ai-memory-linux-x86_64+ tar -xzf artifacts/ai-memory-linux-x86_64.tar.gz \+ -C dist/docker/ai-memory-linux-x86_64++ - uses: docker/setup-buildx-action@v3++ - name: Log in to Docker Hub+ uses: docker/login-action@v3+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Build and push amd64 image by digest+ id: build+ uses: docker/build-push-action@v6+ with:+ context: .+ file: docker/Dockerfile+ target: runtime-prebuilt-amd64+ platforms: linux/amd64+ outputs: type=image,push-by-digest=true,name-canonical=true,push=true+ provenance: false+ tags: ${{ secrets.DOCKERHUB_USERNAME }}/ai-memory++ - name: Export amd64 digest+ run: |+ set -euo pipefail+ digest="${{ steps.build.outputs.digest }}"+ if [ -z "$digest" ]; then+ echo "docker build did not return an amd64 digest" >&2+ exit 1+ fi+ mkdir -p /tmp/digests+ touch "/tmp/digests/${digest#sha256:}"++ - uses: actions/upload-artifact@v4+ with:+ name: docker-digest-amd64+ path: /tmp/digests/*+ if-no-files-found: error+ retention-days: 1++ docker-arm64:+ name: docker arm64 imageneeds: [check-secrets, validate-version]if: needs.check-secrets.outputs.docker_enabled == 'true'runs-on: ubuntu-latest@@ -156,26 +219,90 @@ jobs:username: ${{ secrets.DOCKERHUB_USERNAME }}password: ${{ secrets.DOCKERHUB_TOKEN }}- - name: Build and push+ - name: Build and push arm64 image by digest+ id: builduses: docker/build-push-action@v6with:context: .file: docker/Dockerfile- platforms: linux/amd64,linux/arm64- push: true- tags: |- ${{ secrets.DOCKERHUB_USERNAME }}/ai-memory:latest- ${{ secrets.DOCKERHUB_USERNAME }}/ai-memory:${{ needs.validate-version.outputs.version }}+ target: runtime-source+ platforms: linux/arm64+ outputs: type=image,push-by-digest=true,name-canonical=true,push=true+ provenance: false+ tags: ${{ secrets.DOCKERHUB_USERNAME }}/ai-memorycache-from: type=ghacache-to: type=gha,mode=max+ - name: Export arm64 digest+ run: |+ set -euo pipefail+ digest="${{ steps.build.outputs.digest }}"+ if [ -z "$digest" ]; then+ echo "docker build did not return an arm64 digest" >&2+ exit 1+ fi+ mkdir -p /tmp/digests+ touch "/tmp/digests/${digest#sha256:}"++ - uses: actions/upload-artifact@v4+ with:+ name: docker-digest-arm64+ path: /tmp/digests/*+ if-no-files-found: error+ retention-days: 1++ docker-manifest:+ name: docker manifest + smoke+ needs: [check-secrets, docker-amd64, docker-arm64, validate-version]+ if: needs.check-secrets.outputs.docker_enabled == 'true'+ runs-on: ubuntu-latest+ permissions:+ contents: read+ packages: write+ steps:+ - uses: actions/download-artifact@v4+ with:+ pattern: docker-digest-*+ path: /tmp/digests+ merge-multiple: true++ - uses: docker/setup-qemu-action@v4+ with:+ platforms: arm64++ - uses: docker/setup-buildx-action@v3++ - name: Log in to Docker Hub+ uses: docker/login-action@v3+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Publish multi-arch manifest+ run: |+ set -euo pipefail+ image="${{ secrets.DOCKERHUB_USERNAME }}/ai-memory"+ refs=()+ for digest_file in /tmp/digests/*; do+ refs+=("${image}@sha256:$(basename "$digest_file")")+ done+ if [ "${#refs[@]}" -ne 2 ]; then+ echo "expected 2 image digests, found ${#refs[@]}" >&2+ exit 1+ fi+ docker buildx imagetools create \+ -t "${image}:latest" \+ -t "${image}:${{ needs.validate-version.outputs.version }}" \+ "${refs[@]}"+- name: Smoke test the published imagerun: |- docker pull --platform linux/amd64 \- "${{ secrets.DOCKERHUB_USERNAME }}/ai-memory:${{ needs.validate-version.outputs.version }}"- docker run --rm --platform linux/amd64 \- "${{ secrets.DOCKERHUB_USERNAME }}/ai-memory:${{ needs.validate-version.outputs.version }}" \- --version+ set -euo pipefail+ image="${{ secrets.DOCKERHUB_USERNAME }}/ai-memory:${{ needs.validate-version.outputs.version }}"+ for platform in linux/amd64 linux/arm64; do+ docker pull --platform "$platform" "$image"+ docker run --rm --platform "$platform" "$image" --version+ donegithub-release:name: github releasediff --git a/.gitignore b/.gitignoreindex 4e43c35c..402b272a 100644--- a/.gitignore+++ b/.gitignore@@ -1,5 +1,6 @@# Rust build artefacts./target/+/dist/**/*.rs.bk**/*.rs.origdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex b6d528ce..796d88be 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).## [Unreleased]+### Changed+- Docker release publishing now reuses the prebuilt Linux x86_64 release+ artifact for the amd64 image and smoke-tests both amd64 and arm64 images+ after assembling the multi-arch manifest.## [0.5.0] - 2026-05-27### Fixeddiff --git a/docker/Dockerfile b/docker/Dockerfileindex 0de0588a..a002a05c 100644--- a/docker/Dockerfile+++ b/docker/Dockerfile@@ -6,6 +6,10 @@# Runtime: debian:bookworm-slim with a non-root `ai-memory` user that# owns /data. CA certificates included for outgoing HTTPS (LLM# providers in M6+).+#+# The default final target builds the binary from source. Release automation can+# target `runtime-prebuilt-amd64` after downloading the native release artifact,+# avoiding a second amd64 compile in the Docker publish job.FROM rust:1.95-slim-bookworm AS builderWORKDIR /work@@ -27,21 +31,19 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \cargo build --release -p ai-memory-cli \&& cp target/release/ai-memory /usr/local/bin/ai-memory-FROM debian:bookworm-slim+FROM debian:bookworm-slim AS runtime-baseRUN apt-get update \&& apt-get install -y --no-install-recommends ca-certificates \&& rm -rf /var/lib/apt/lists/* \&& useradd --system --uid 1000 --user-group --home-dir /data \- --shell /usr/sbin/nologin ai-memory \+ --shell /usr/sbin/nologin ai-memory \&& mkdir -p /data \&& chown -R ai-memory:ai-memory /data-COPY --from=builder /usr/local/bin/ai-memory /usr/local/bin/ai-memory# Lifecycle-hook scripts bundled into the image so docker-only users# can `ai-memory setup-agent` without needing a repo checkout. The# scripts live on a path scanned by `install_hooks::resolve_hooks_dir`# (and by `setup_agent::resolve_source`).COPY hooks /usr/local/share/ai-memory/hooks-USER ai-memoryENV AI_MEMORY_DATA_DIR=/dataWORKDIR /dataEXPOSE 49374@@ -49,3 +51,11 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \CMD ["/usr/local/bin/ai-memory", "status"]ENTRYPOINT ["/usr/local/bin/ai-memory"]CMD ["serve", "--transport", "http", "--bind", "0.0.0.0:49374", "--enable-web"]++FROM runtime-base AS runtime-prebuilt-amd64+COPY dist/docker/ai-memory-linux-x86_64/ai-memory /usr/local/bin/ai-memory+USER ai-memory++FROM runtime-base AS runtime-source+COPY --from=builder /usr/local/bin/ai-memory /usr/local/bin/ai-memory+USER ai-memory