-
Notifications
You must be signed in to change notification settings - Fork 226
/
Copy pathDockerfile
100 lines (94 loc) · 2.73 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM debian:bookworm-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
iproute2 \
iptables \
; \
rm -rf /var/lib/apt/lists/*
# https://pkgs.tailscale.com/stable/#static
ENV TAILSCALE_VERSION 1.80.0
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "$dpkgArch" in \
amd64) arch='amd64' ;; \
arm64) arch='arm64' ;; \
# Tailscale's "arm" is GOARM=5 (https://github.com/tailscale/tailscale/issues/5482)
armel) arch='arm' ;; \
armhf) arch='arm' ;; \
i386) arch='386' ;; \
mips64el) arch='mips64le' ;; \
riscv64) arch='riscv64' ;; \
*) arch='src' ;; \
esac; \
if [ "$arch" != 'src' ]; then \
url="https://pkgs.tailscale.com/stable/tailscale_${TAILSCALE_VERSION}_${arch}.tgz"; \
else \
url="https://github.com/tailscale/tailscale/archive/refs/tags/v${TAILSCALE_VERSION}.tar.gz"; \
fi; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates wget; \
if [ "$arch" = 'src' ]; then \
( \
. /etc/os-release; \
if [ -n "${VERSION_CODENAME}" ]; then \
echo "deb https://deb.debian.org/debian $VERSION_CODENAME-backports main" > /etc/apt/sources.list.d/backports.list; \
apt-get update; \
apt-get install -y --no-install-recommends -t "$VERSION_CODENAME-backports" golang-go; \
else \
# must be ports/unstable, so probably new enough Go as-is
apt-get install -y --no-install-recommends golang-go; \
fi; \
); \
fi; \
\
wget -O tailscale.tgz "$url"; \
\
mkdir -p /opt/tailscale; \
tar \
--extract \
--file tailscale.tgz \
--directory /opt/tailscale \
--strip-components 1 \
--verbose \
; \
rm tailscale.tgz; \
\
if [ "$arch" = 'src' ]; then \
mv /opt/tailscale /tmp/src; \
( \
mkdir -p /opt/tailscale; \
cd /tmp/src; \
export GOBIN=/opt/tailscale GOCACHE="$PWD/.gocache" GOPATH="$PWD/.gopath"; \
# https://github.com/tailscale/tailscale/blob/v1.56.1/build_dist.sh#L32
# we didn't "git clone" so let's reimplement "build_dist.sh" to the best of our ability
version="$(cat VERSION.txt)"; \
go install \
-ldflags " \
-X tailscale.com/version.longStamp=$version \
-X tailscale.com/version.shortStamp=$version \
" \
./cmd/tailscale \
./cmd/tailscaled \
; \
); \
rm -rf /tmp/src; \
fi; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
ln -sv /opt/tailscale/tailscale* /usr/local/bin/; \
tailscaled --version; \
tailscale --version
VOLUME /var/lib/tailscale
CMD ["tailscaled"]