From 033ae4e2d936ee6929b072b8eebc22dc2088965f Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Wed, 16 Aug 2023 16:37:42 -0400 Subject: [PATCH] Pre-build the tsnet/ts client deps on the go module layer This should concentrate the bulk of the build duration on the dependency level, since it's tsnet that pulls in all those libraries (and it changes rarely). --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 89d5fd7..02bb006 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,8 @@ ENV CGO_ENABLED=0 COPY go.mod go.sum ./ RUN go mod download && \ go mod verify && \ - echo 'package main\nimport (_ "tailscale.com/tsnet")\nfunc main(){}' > main.go && \ - go build -v ./ && \ + echo 'package main\nimport (\n_ "tailscale.com/tsnet"\n_ "tailscale.com/client/tailscale"\n)\nfunc main(){}' > main.go && \ + go build -ldflags="-s -w" -v ./ && \ rm main.go COPY . .