Skip to content

Commit 0cfe145

Browse files
authored
Add gocache to speed up local Docker builds (#3585)
Caching link from Go documentation: https://pkg.go.dev/cmd/go#hdr-Build_and_test_caching Locally, when re-running `docker build` commands this take the build from ~260-290s down to 20-26s.
1 parent f58daeb commit 0cfe145

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stacks/flow.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ WORKDIR /root/flow
2020
ENV CGO_ENABLED=1
2121
# Generate the typed handler wrapper
2222
RUN go generate
23-
RUN go build -o /root/peer-flow
23+
ENV GOCACHE=/root/.cache/go-build
24+
RUN --mount=type=cache,target="/root/.cache/go-build" go build -o /root/peer-flow
2425

2526
FROM alpine:3.22@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 AS flow-base
2627
ENV TZ=UTC

0 commit comments

Comments
 (0)