From 88830436542b016449a79985f5816a857d9c28c1 Mon Sep 17 00:00:00 2001 From: simonhammes Date: Tue, 3 Sep 2024 23:54:00 +0200 Subject: [PATCH] build: Improve go build caching In my experience, this speeds up the build step quite a lot :) --- dev/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/Dockerfile b/dev/Dockerfile index 18616db35..838b673ff 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -11,7 +11,8 @@ RUN ls -al ARG CGO_ENABLED=0 # `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations ARG SKAFFOLD_GO_GCFLAGS -RUN go build -gcflags="$SKAFFOLD_GO_GCFLAGS" -o hcloud-cloud-controller-manager.bin github.com/hetznercloud/hcloud-cloud-controller-manager +ENV GOCACHE=/cache +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 FROM alpine:3.20