tailscale-docker/images/tailscale/start.sh
Louis-Philippe Asselin 7c146ab113
Version 1.0 (#2)
* Adds @rhjensen79 k8s example

* Instructions in README instead of Makefile

* Adds optional TAILSCALE_HOSTNAME instead of hardcoding in tailscale.sh

* TAILSCALE_STATE_ARG env variable, to enable stateful-example which reuses the same ip between deployments

* Fix tailscale.sh for proper `tailscale logout` on container SIGTERM

* Adds github action to build image

* all docker images are in the images folder. Instead of repeating in each example

Co-authored-by: Robert Jensen <robert@robert-jensen.dk>
2022-09-01 14:51:23 -04:00

12 lines
No EOL
396 B
Bash

#!/bin/ash
trap 'kill -TERM $PID' TERM INT
echo "Starting Tailscale daemon"
# -state=mem: will logout and remove ephemeral node from network immediately after ending.
tailscaled --tun=userspace-networking --state=${TAILSCALE_STATE_ARG} &
PID=$!
until tailscale up --authkey="${TAILSCALE_AUTH_KEY}" --hostname="${TAILSCALE_HOSTNAME}"; do
sleep 0.1
done
tailscale status
wait ${PID}
wait ${PID}