From 0aaec7c201edaca9b57e2751a2d1402ac174cde7 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 20 Aug 2024 09:48:14 +1000 Subject: [PATCH] Add missing GOMODCACHE caching when building op-stack-go services (#11512) --- ops/docker/op-stack-go/Dockerfile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ops/docker/op-stack-go/Dockerfile b/ops/docker/op-stack-go/Dockerfile index e21bf5ea677e..cc58a0969178 100644 --- a/ops/docker/op-stack-go/Dockerfile +++ b/ops/docker/op-stack-go/Dockerfile @@ -48,62 +48,62 @@ ARG TARGETARCH # "sharing" defaults to "shared", the cache will thus be available to other concurrent docker builds. FROM --platform=$BUILDPLATFORM builder AS cannon-builder ARG CANNON_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd cannon && make cannon \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd cannon && make cannon \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$CANNON_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-program-builder ARG OP_PROGRAM_VERSION=v0.0.0 # note: we only build the host, that's all the user needs. No Go MIPS cross-build in docker -RUN --mount=type=cache,target=/root/.cache/go-build cd op-program && make op-program-host \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-program && make op-program-host \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-heartbeat-builder ARG OP_HEARTBEAT_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-heartbeat && make op-heartbeat \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-heartbeat && make op-heartbeat \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_HEARTBEAT_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-wheel-builder ARG OP_WHEEL_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-wheel && make op-wheel \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-wheel && make op-wheel \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_WHEEL_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-node-builder ARG OP_NODE_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-node && make op-node \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-node && make op-node \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_NODE_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-challenger-builder ARG OP_CHALLENGER_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-challenger && make op-challenger \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-challenger && make op-challenger \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_CHALLENGER_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-dispute-mon-builder ARG OP_DISPUTE_MON_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-dispute-mon && make op-dispute-mon \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-dispute-mon && make op-dispute-mon \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_DISPUTE_MON_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-batcher-builder ARG OP_BATCHER_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-batcher && make op-batcher \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-batcher && make op-batcher \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_BATCHER_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-proposer-builder ARG OP_PROPOSER_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-proposer && make op-proposer \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-proposer && make op-proposer \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROPOSER_VERSION" FROM --platform=$BUILDPLATFORM builder AS op-conductor-builder ARG OP_CONDUCTOR_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-conductor && make op-conductor \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-conductor && make op-conductor \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_CONDUCTOR_VERSION" FROM --platform=$BUILDPLATFORM builder AS da-server-builder -RUN --mount=type=cache,target=/root/.cache/go-build cd op-alt-da && make da-server \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-alt-da && make da-server \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE FROM --platform=$BUILDPLATFORM builder AS op-supervisor-builder ARG OP_SUPERVISOR_VERSION=v0.0.0 -RUN --mount=type=cache,target=/root/.cache/go-build cd op-supervisor && make op-supervisor \ +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build cd op-supervisor && make op-supervisor \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_SUPERVISOR_VERSION" FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE AS cannon-target