Skip to content

Commit c99a161

Browse files
authored
chore(dev): improve go build caching (#735)
Speed up re-builds of the container image in the dev environment, by using a buildx cache mount for the go cache. Co-authored-by: simonhammes <[email protected]>
1 parent 4801f0e commit c99a161

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dev/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ RUN ls -al
1111
ARG CGO_ENABLED=0
1212
# `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations
1313
ARG SKAFFOLD_GO_GCFLAGS
14-
RUN go build -gcflags="$SKAFFOLD_GO_GCFLAGS" -o hcloud-cloud-controller-manager.bin github.com/hetznercloud/hcloud-cloud-controller-manager
14+
ENV GOCACHE=/cache
15+
RUN --mount=type=cache,target="/cache" go build -gcflags="$SKAFFOLD_GO_GCFLAGS" -o hcloud-cloud-controller-manager.bin github.com/hetznercloud/hcloud-cloud-controller-manager
1516

1617
FROM alpine:3.20
1718

0 commit comments

Comments
 (0)