From 58bb6a4a95ecbd6cc295358a7487970636f8790b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=C3=A1n=20C=20McCord?= Date: Thu, 6 Aug 2020 12:43:51 -0400 Subject: [PATCH] initial commit --- Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 4 ++++ entrypoint.sh | 7 +++++++ 3 files changed, 37 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..50c7bcf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM alpine:3.11 AS build + +ARG CHANNEL=unstable +ARG VERSION=0.99.1-127 +ARG ARCH=amd64 + +RUN mkdir /build +WORKDIR /build +RUN apk add --no-cache curl tar + +RUN curl -vsLo tailscale.tar.gz "https://pkgs.tailscale.com/${CHANNEL}/tailscale_${VERSION}_${ARCH}.tgz" && \ + tar xvf tailscale.tar.gz && \ + mv "tailscale_${VERSION}_${ARCH}/tailscaled" . && \ + mv "tailscale_${VERSION}_${ARCH}/tailscale" . + +FROM alpine:3.11 + +# Tailscaled depends on iptables (for now) +RUN apk add --no-cache iptables + +COPY --from=build /build/tailscale /usr/bin/ +COPY --from=build /build/tailscaled /usr/bin/ + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..5215d32 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# SCM tailscaled for kubernetes + +Taken from gist: https://gist.github.com/hamishforbes/2ac7ae9d7ea47cad4e3a813c9b45c10f + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..e5e8768 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +# Create the tun device path if required +if [ ! -d /dev/net ]; then mkdir /dev/net; fi +if [ ! -e /dev/net/tun ]; then mknod /dev/net/tun c 10 200; fi + +# Wait 5s for the daemon to start and then run tailscale up to configure +/bin/sh -c "sleep 5; tailscale up --authkey=${TAILSCALE_AUTH} -advertise-tags=${TAILSCALE_TAGS}" & +exec /usr/bin/tailscaled --state=/tailscale/tailscaled.state