Skip to content

Commit ca27e46

Browse files
committed
fix(agent): use per-stage BuildKit cache IDs to avoid parallel write conflict
1 parent 290e372 commit ca27e46

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Dockerfile.agent

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
FROM golang:1.25-alpine AS agent-builder
44
WORKDIR /workspace
55
COPY go.mod go.sum ./
6-
RUN --mount=type=cache,id=gomod,target=/root/go/pkg/mod go mod download
6+
RUN --mount=type=cache,id=agent-gomod,target=/root/go/pkg/mod go mod download
77
COPY api/ api/
88
COPY cmd/agent/ cmd/agent/
99
COPY internal/ internal/
1010
ARG TARGETARCH
11-
RUN --mount=type=cache,id=gomod,target=/root/go/pkg/mod \
12-
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
11+
RUN --mount=type=cache,id=agent-gomod,target=/root/go/pkg/mod \
12+
--mount=type=cache,id=agent-gobuild,target=/root/.cache/go-build \
1313
CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o agent ./cmd/agent
1414

1515
FROM golang:1.25-alpine AS guest-agent-builder
1616
WORKDIR /workspace
1717
COPY go.mod go.sum ./
18-
RUN --mount=type=cache,id=gomod,target=/root/go/pkg/mod go mod download
18+
RUN --mount=type=cache,id=guest-gomod,target=/root/go/pkg/mod go mod download
1919
COPY api/ api/
2020
COPY cmd/guest-agent/ cmd/guest-agent/
2121
COPY internal/ internal/
2222
ARG TARGETARCH
23-
RUN --mount=type=cache,id=gomod,target=/root/go/pkg/mod \
24-
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
23+
RUN --mount=type=cache,id=guest-gomod,target=/root/go/pkg/mod \
24+
--mount=type=cache,id=guest-gobuild,target=/root/.cache/go-build \
2525
CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o guest-agent ./cmd/guest-agent
2626

2727
FROM gcr.io/distroless/static:nonroot AS runtime

0 commit comments

Comments
 (0)