mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
76904b82e7
This implements the same functionality as the former run.sh, but in Go and with a little better awareness of tailscaled's lifecycle. Also adds TS_AUTH_ONCE, which fixes the unfortunate behavior run.sh had where it would unconditionally try to reauth every time if you gave it an authkey, rather than try to use it only if auth is actually needed. This makes it a bit nicer to deploy these containers in automation, since you don't have to run the container once, then go and edit its definition to remove authkeys. Signed-off-by: David Anderson <danderson@tailscale.com>
49 lines
1.7 KiB
Bash
Executable File
49 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
#
|
|
# Runs `go build` with flags configured for docker distribution. All
|
|
# it does differently from `go build` is burn git commit and version
|
|
# information into the binaries inside docker, so that we can track down user
|
|
# issues.
|
|
#
|
|
############################################################################
|
|
#
|
|
# WARNING: Tailscale is not yet officially supported in container
|
|
# environments, such as Docker and Kubernetes. Though it should work, we
|
|
# don't regularly test it, and we know there are some feature limitations.
|
|
#
|
|
# See current bugs tagged "containers":
|
|
# https://github.com/tailscale/tailscale/labels/containers
|
|
#
|
|
############################################################################
|
|
|
|
set -eu
|
|
|
|
# Use the "go" binary from the "tool" directory (which is github.com/tailscale/go)
|
|
export PATH=$PWD/tool:$PATH
|
|
|
|
eval $(./build_dist.sh shellvars)
|
|
DEFAULT_TAGS="v${VERSION_SHORT},v${VERSION_MINOR}"
|
|
DEFAULT_REPOS="tailscale/tailscale,ghcr.io/tailscale/tailscale"
|
|
DEFAULT_BASE="ghcr.io/tailscale/alpine-base:3.16"
|
|
|
|
PUSH="${PUSH:-false}"
|
|
REPOS="${REPOS:-${DEFAULT_REPOS}}"
|
|
TAGS="${TAGS:-${DEFAULT_TAGS}}"
|
|
BASE="${BASE:-${DEFAULT_BASE}}"
|
|
|
|
go run github.com/tailscale/mkctr \
|
|
--gopaths="\
|
|
tailscale.com/cmd/tailscale:/usr/local/bin/tailscale, \
|
|
tailscale.com/cmd/tailscaled:/usr/local/bin/tailscaled, \
|
|
tailscale.com/cmd/containerboot:/usr/local/bin/containerboot" \
|
|
--ldflags="\
|
|
-X tailscale.com/version.Long=${VERSION_LONG} \
|
|
-X tailscale.com/version.Short=${VERSION_SHORT} \
|
|
-X tailscale.com/version.GitCommit=${VERSION_GIT_HASH}" \
|
|
--base="${BASE}" \
|
|
--tags="${TAGS}" \
|
|
--repos="${REPOS}" \
|
|
--push="${PUSH}" \
|
|
/usr/local/bin/containerboot
|