#!/usr/bin/env bash # Build the Hermes Agent image locally, mirroring what the `images` workflow does. # # Hermes ships its own Dockerfile, so there is no vendored Containerfile here — we # build straight from the upstream git context at a release tag. Override the ref # with HERMES_REF (e.g. v0.2.0); empty resolves the latest upstream release. set -euo pipefail REGISTRY="${REGISTRY:-git.lair.cafe}" IMAGE_NAME="${REGISTRY}/lair/hermes" HERMES_REF="${HERMES_REF:-}" if [ -z "${HERMES_REF}" ]; then HERMES_REF=$(curl -fsS 'https://api.github.com/repos/NousResearch/hermes-agent/releases/latest' | jq -r '.tag_name // empty') [ -n "${HERMES_REF}" ] || HERMES_REF=$(curl -fsS 'https://api.github.com/repos/NousResearch/hermes-agent/tags' | jq -r '.[0].name // empty') fi [ -n "${HERMES_REF}" ] || { echo "could not resolve an upstream hermes ref"; exit 1; } VERSION="${HERMES_REF#v}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BASE="localhost/hermes-upstream:${VERSION}" echo "[1/2] building upstream ${BASE} from NousResearch/hermes-agent#${HERMES_REF}" podman build --pull=newer -t "${BASE}" \ "https://github.com/NousResearch/hermes-agent.git#${HERMES_REF}" echo "[2/2] building derived (writable /opt/hermes) -> ${IMAGE_NAME}:${VERSION}" podman build --build-arg BASE="${BASE}" \ -t "${IMAGE_NAME}:${VERSION}" \ -t "${IMAGE_NAME}:latest" \ "${SCRIPT_DIR}" echo "built ${IMAGE_NAME}:${VERSION} and :latest" echo "push with: podman push ${IMAGE_NAME}:${VERSION} && podman push ${IMAGE_NAME}:latest"