From ef351ac0dd37281448361e29413590f33dfc3f57 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 29 Jun 2022 07:57:00 -0700 Subject: [PATCH] Dockerfile: fix build The Dockerfile directions said: But that failed with: Step 14/15 : FROM ghcr.io/tailscale/alpine-base:3.14 Head "https://ghcr.io/v2/tailscale/alpine-base/manifests/3.14": denied: denied So I guess the Dockerfile.base part was undocumented. But it only had one line anyway, so move it here to avoid the intermediate layer's published permissions problem entirely. Also optimize the cachability a bit while here. Change-Id: I846ad59fe7e88e6126925689fae78bfb80c279f0 Signed-off-by: Brad Fitzpatrick --- Dockerfile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9d9546d32..f3aea0039 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,18 @@ WORKDIR /go/src/tailscale COPY go.mod go.sum ./ RUN go mod download +# Pre-build some stuff before the following COPY line invalidates the Docker cache. +RUN go install \ + github.com/aws/aws-sdk-go-v2/aws \ + github.com/aws/aws-sdk-go-v2/config \ + gvisor.dev/gvisor/pkg/tcpip/adapters/gonet \ + gvisor.dev/gvisor/pkg/tcpip/stack \ + golang.org/x/crypto/ssh \ + golang.org/x/crypto/acme \ + nhooyr.io/websocket \ + github.com/mdlayher/netlink \ + golang.zx2c4.com/wireguard/device + COPY . . # see build_docker.sh @@ -56,5 +68,7 @@ RUN GOARCH=$TARGETARCH go install -ldflags="\ -X tailscale.com/version.GitCommit=$VERSION_GIT_HASH" \ -v ./cmd/tailscale ./cmd/tailscaled -FROM ghcr.io/tailscale/alpine-base:3.14 +FROM alpine:3.16 +RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables + COPY --from=build-env /go/bin/* /usr/local/bin/