2023-01-27 21:37:20 +00:00
|
|
|
# Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2020-02-11 01:50:05 +00:00
|
|
|
|
2021-01-12 03:23:43 +00:00
|
|
|
############################################################################
|
|
|
|
#
|
2021-10-12 19:27:39 +00:00
|
|
|
# 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.
|
2021-01-12 03:23:43 +00:00
|
|
|
#
|
2021-10-12 19:27:39 +00:00
|
|
|
# See current bugs tagged "containers":
|
2021-01-12 03:23:43 +00:00
|
|
|
# https://github.com/tailscale/tailscale/labels/containers
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-04-06 14:57:47 +00:00
|
|
|
# This Dockerfile includes all the tailscale binaries.
|
|
|
|
#
|
|
|
|
# To build the Dockerfile:
|
|
|
|
#
|
2021-10-16 07:43:25 +00:00
|
|
|
# $ docker build -t tailscale/tailscale .
|
2020-04-06 14:57:47 +00:00
|
|
|
#
|
|
|
|
# To run the tailscaled agent:
|
|
|
|
#
|
2021-10-16 07:43:25 +00:00
|
|
|
# $ docker run -d --name=tailscaled -v /var/lib:/var/lib -v /dev/net/tun:/dev/net/tun --network=host --privileged tailscale/tailscale tailscaled
|
2020-04-06 14:57:47 +00:00
|
|
|
#
|
|
|
|
# To then log in:
|
|
|
|
#
|
|
|
|
# $ docker exec tailscaled tailscale up
|
|
|
|
#
|
|
|
|
# To see status:
|
|
|
|
#
|
|
|
|
# $ docker exec tailscaled tailscale status
|
|
|
|
|
|
|
|
|
2023-02-01 21:43:06 +00:00
|
|
|
FROM golang:1.20-alpine AS build-env
|
2020-02-11 01:50:05 +00:00
|
|
|
|
|
|
|
WORKDIR /go/src/tailscale
|
2020-02-14 21:31:14 +00:00
|
|
|
|
2021-07-28 18:07:50 +00:00
|
|
|
COPY go.mod go.sum ./
|
2020-02-14 21:31:14 +00:00
|
|
|
RUN go mod download
|
|
|
|
|
2022-06-29 14:57:00 +00:00
|
|
|
# Pre-build some stuff before the following COPY line invalidates the Docker cache.
|
|
|
|
RUN go install \
|
|
|
|
github.com/aws/aws-sdk-go-v2/aws \
|
|
|
|
github.com/aws/aws-sdk-go-v2/config \
|
|
|
|
gvisor.dev/gvisor/pkg/tcpip/adapters/gonet \
|
|
|
|
gvisor.dev/gvisor/pkg/tcpip/stack \
|
|
|
|
golang.org/x/crypto/ssh \
|
|
|
|
golang.org/x/crypto/acme \
|
|
|
|
nhooyr.io/websocket \
|
|
|
|
github.com/mdlayher/netlink \
|
|
|
|
golang.zx2c4.com/wireguard/device
|
|
|
|
|
2020-02-11 01:50:05 +00:00
|
|
|
COPY . .
|
|
|
|
|
2021-02-19 21:06:07 +00:00
|
|
|
# see build_docker.sh
|
2021-03-05 16:51:27 +00:00
|
|
|
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
|
2021-10-28 10:51:09 +00:00
|
|
|
ARG TARGETARCH
|
2021-01-20 16:55:05 +00:00
|
|
|
|
2021-12-20 02:14:25 +00:00
|
|
|
RUN GOARCH=$TARGETARCH go install -ldflags="\
|
2021-03-05 16:51:27 +00:00
|
|
|
-X tailscale.com/version.Long=$VERSION_LONG \
|
|
|
|
-X tailscale.com/version.Short=$VERSION_SHORT \
|
|
|
|
-X tailscale.com/version.GitCommit=$VERSION_GIT_HASH" \
|
2022-10-25 20:12:54 +00:00
|
|
|
-v ./cmd/tailscale ./cmd/tailscaled ./cmd/containerboot
|
2020-02-11 01:50:05 +00:00
|
|
|
|
2022-06-29 14:57:00 +00:00
|
|
|
FROM alpine:3.16
|
|
|
|
RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables
|
|
|
|
|
2020-02-14 21:31:14 +00:00
|
|
|
COPY --from=build-env /go/bin/* /usr/local/bin/
|
2022-10-25 20:12:54 +00:00
|
|
|
# For compat with the previous run.sh, although ideally you should be
|
|
|
|
# using build_docker.sh which sets an entrypoint for the image.
|
|
|
|
RUN ln -s /usr/local/bin/containerboot /tailscale/run.sh
|