Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
build: cross-compile multi-arch Docker images natively with BuildKit cache
Antonio Ojea6b5477eb117a
diff --git a/.dockerignore b/.dockerignoreindex c8d24c3e..fb493e90 100644--- a/.dockerignore+++ b/.dockerignore@@ -26,11 +26,11 @@ mobile/logcat.txt# Build outputs and cachesbin/dist/-node_modules/-__pycache__/-.pytest_cache/+**/node_modules/+**/__pycache__/+**/.pytest_cache/.worktrees/-.venv/+**/.venv/*.test*.outcoverage.*diff --git a/Dockerfile.sam-console b/Dockerfile.sam-consoleindex 84c0ee98..428fcccd 100644--- a/Dockerfile.sam-console+++ b/Dockerfile.sam-console@@ -1,14 +1,18 @@-FROM golang:1.27.1-alpine@sha256:8a5910f31396cd4d89662f56c68b3ae31d374308270a1c3bd96672ee5ed43414 AS builder+FROM --platform=$BUILDPLATFORM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builder-WORKDIR /src+WORKDIR /appCOPY go.mod go.sum ./-RUN go mod download+RUN --mount=type=cache,target=/go/pkg/mod go mod downloadCOPY . .ARG VERSION=devel-RUN CGO_ENABLED=0 go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o /bin/sam-console ./cmd/sam-console+ARG TARGETOS=linux+ARG TARGETARCH+RUN --mount=type=cache,target=/go/pkg/mod \+ --mount=type=cache,target=/root/.cache/go-build \+ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o /bin/sam-console ./cmd/sam-console-FROM gcr.io/distroless/static-debian12:nonroot@sha256:afa5c872c891853ca7fcf1f12c3edb23f7eeef36189728842dd51042ff57f7ab+FROM gcr.io/distroless/static:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3WORKDIR /appCOPY --from=builder --chown=nonroot:nonroot /bin/sam-console /usr/local/bin/sam-consolediff --git a/Dockerfile.sam-control-plane b/Dockerfile.sam-control-planeindex 21c39c3d..6767bad0 100644--- a/Dockerfile.sam-control-plane+++ b/Dockerfile.sam-control-plane@@ -1,11 +1,15 @@# Stage 1: Build-FROM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builder+FROM --platform=$BUILDPLATFORM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builderWORKDIR /appCOPY go.mod go.sum ./-RUN go mod download+RUN --mount=type=cache,target=/go/pkg/mod go mod downloadCOPY . .ARG VERSION=devel-RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-control-plane ./cmd/sam-control-plane+ARG TARGETOS=linux+ARG TARGETARCH+RUN --mount=type=cache,target=/go/pkg/mod \+ --mount=type=cache,target=/root/.cache/go-build \+ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-control-plane ./cmd/sam-control-plane# Pre-create the sqlite data dir owned by the nonroot UID so that a fresh# named/anonymous volume mounted over it inherits writable ownership instead# of defaulting to root.diff --git a/Dockerfile.sam-node b/Dockerfile.sam-nodeindex fea8b045..292e4e60 100644--- a/Dockerfile.sam-node+++ b/Dockerfile.sam-node@@ -1,11 +1,15 @@# Stage 1: Build-FROM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builder+FROM --platform=$BUILDPLATFORM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builderWORKDIR /appCOPY go.mod go.sum ./-RUN go mod download+RUN --mount=type=cache,target=/go/pkg/mod go mod downloadCOPY . .ARG VERSION=devel-RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-node ./cmd/sam-node+ARG TARGETOS=linux+ARG TARGETARCH+RUN --mount=type=cache,target=/go/pkg/mod \+ --mount=type=cache,target=/root/.cache/go-build \+ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-node ./cmd/sam-node# Pre-create the default data dir owned by the nonroot UID so that a fresh# named/anonymous volume mounted over it inherits writable ownership instead# of defaulting to root.diff --git a/Dockerfile.sam-one b/Dockerfile.sam-oneindex d60d075c..04d27993 100644--- a/Dockerfile.sam-one+++ b/Dockerfile.sam-one@@ -1,11 +1,15 @@# Stage 1: Build-FROM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builder+FROM --platform=$BUILDPLATFORM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builderWORKDIR /appCOPY go.mod go.sum ./-RUN go mod download+RUN --mount=type=cache,target=/go/pkg/mod go mod downloadCOPY . .ARG VERSION=devel-RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-one ./cmd/sam-one+ARG TARGETOS=linux+ARG TARGETARCH+RUN --mount=type=cache,target=/go/pkg/mod \+ --mount=type=cache,target=/root/.cache/go-build \+ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-one ./cmd/sam-one# Pre-create the data dir owned by the nonroot UID so that a fresh# named/anonymous volume mounted over it inherits writable ownership instead# of defaulting to root.diff --git a/Dockerfile.sam-router b/Dockerfile.sam-routerindex 207436dc..532af04e 100644--- a/Dockerfile.sam-router+++ b/Dockerfile.sam-router@@ -1,11 +1,15 @@# Stage 1: Build-FROM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builder+FROM --platform=$BUILDPLATFORM golang:1.27.1@sha256:3680233e3204827fbdc66088528ae6d4b3d034f51d03a99d454f6de034888244 AS builderWORKDIR /appCOPY go.mod go.sum ./-RUN go mod download+RUN --mount=type=cache,target=/go/pkg/mod go mod downloadCOPY . .ARG VERSION=devel-RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-router ./cmd/sam-router+ARG TARGETOS=linux+ARG TARGETARCH+RUN --mount=type=cache,target=/go/pkg/mod \+ --mount=type=cache,target=/root/.cache/go-build \+ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -buildvcs=false -ldflags="-X github.com/google/sam/internal/version.Version=${VERSION}" -o sam-router ./cmd/sam-router# Pre-create the keys/data dir owned by the nonroot UID so that a fresh# named/anonymous volume mounted over it inherits writable ownership instead# of defaulting to root.diff --git a/Dockerfile.sam-sdk-js b/Dockerfile.sam-sdk-jsindex 5ebc00d6..4687bbf6 100644--- a/Dockerfile.sam-sdk-js+++ b/Dockerfile.sam-sdk-js@@ -9,7 +9,7 @@# which are development dependencies of the SDK, not dependencies.# Stage 1: Build-FROM node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c AS builder+FROM --platform=$BUILDPLATFORM node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c AS builderWORKDIR /srcCOPY sdk/js/package.json sdk/js/package-lock.json sdk/js/.npmrc ./RUN npm ci --no-fund --no-audit