2024-05-24 10:15:34 +02:00
|
|
|
# Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2024-02-12 14:53:07 +01:00
|
|
|
|
2024-05-24 10:15:34 +02:00
|
|
|
# This Dockerfile is more or less lifted from tailscale/tailscale
|
|
|
|
# to ensure a similar build process when testing the HEAD of tailscale.
|
2022-03-18 17:05:28 +01:00
|
|
|
|
2024-08-23 15:28:54 +02:00
|
|
|
FROM golang:1.23-alpine AS build-env
|
2022-03-18 17:05:28 +01:00
|
|
|
|
2024-05-24 10:15:34 +02:00
|
|
|
WORKDIR /go/src
|
2022-10-26 13:31:30 +02:00
|
|
|
|
2024-05-24 10:15:34 +02:00
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
|
|
|
# Replace `RUN git...` with `COPY` and a local checked out version of Tailscale in `./tailscale`
|
|
|
|
# to test specific commits of the Tailscale client. This is useful when trying to find out why
|
|
|
|
# something specific broke between two versions of Tailscale with for example `git bisect`.
|
|
|
|
# COPY ./tailscale .
|
2022-03-18 17:05:28 +01:00
|
|
|
RUN git clone https://github.com/tailscale/tailscale.git
|
|
|
|
|
2024-05-24 10:15:34 +02:00
|
|
|
WORKDIR /go/src/tailscale
|
|
|
|
|
|
|
|
|
|
|
|
# see build_docker.sh
|
|
|
|
ARG VERSION_LONG=""
|
|
|
|
ENV VERSION_LONG=$VERSION_LONG
|
|
|
|
ARG VERSION_SHORT=""
|
|
|
|
ENV VERSION_SHORT=$VERSION_SHORT
|
|
|
|
ARG VERSION_GIT_HASH=""
|
|
|
|
ENV VERSION_GIT_HASH=$VERSION_GIT_HASH
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
2024-11-22 11:57:01 +01:00
|
|
|
ARG BUILD_TAGS=""
|
|
|
|
|
|
|
|
RUN GOARCH=$TARGETARCH go install -tags="${BUILD_TAGS}" -ldflags="\
|
2024-05-24 10:15:34 +02:00
|
|
|
-X tailscale.com/version.longStamp=$VERSION_LONG \
|
|
|
|
-X tailscale.com/version.shortStamp=$VERSION_SHORT \
|
|
|
|
-X tailscale.com/version.gitCommitStamp=$VERSION_GIT_HASH" \
|
|
|
|
-v ./cmd/tailscale ./cmd/tailscaled ./cmd/containerboot
|
|
|
|
|
|
|
|
FROM alpine:3.18
|
|
|
|
RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables curl
|
2022-08-16 17:52:59 +02:00
|
|
|
|
2024-05-24 10:15:34 +02:00
|
|
|
COPY --from=build-env /go/bin/* /usr/local/bin/
|
|
|
|
# For compat with the previous run.sh, although ideally you should be
|
|
|
|
# using build_docker.sh which sets an entrypoint for the image.
|
|
|
|
RUN mkdir /tailscale && ln -s /usr/local/bin/containerboot /tailscale/run.sh
|