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 20:27:39 +01: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 20:27:39 +01:00
|
|
|
# See current bugs tagged "containers":
|
2021-01-12 03:23:43 +00:00
|
|
|
# https://github.com/tailscale/tailscale/labels/containers
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-04-06 15:57:47 +01:00
|
|
|
# This Dockerfile includes all the tailscale binaries.
|
|
|
|
#
|
|
|
|
# To build the Dockerfile:
|
|
|
|
#
|
2021-10-16 08:43:25 +01:00
|
|
|
# $ docker build -t tailscale/tailscale .
|
2020-04-06 15:57:47 +01:00
|
|
|
#
|
|
|
|
# To run the tailscaled agent:
|
|
|
|
#
|
2021-10-16 08:43:25 +01: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 15:57:47 +01:00
|
|
|
#
|
|
|
|
# To then log in:
|
|
|
|
#
|
|
|
|
# $ docker exec tailscaled tailscale up
|
|
|
|
#
|
|
|
|
# To see status:
|
|
|
|
#
|
|
|
|
# $ docker exec tailscaled tailscale status
|
|
|
|
|
|
|
|
|
2023-08-09 04:44:31 +01:00
|
|
|
FROM golang:1.21-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 19:07:50 +01:00
|
|
|
COPY go.mod go.sum ./
|
2020-02-14 21:31:14 +00:00
|
|
|
RUN go mod download
|
|
|
|
|
2022-06-29 15:57:00 +01: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 \
|
2023-06-14 18:21:30 +01:00
|
|
|
github.com/mdlayher/netlink
|
2022-06-29 15:57:00 +01:00
|
|
|
|
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 11:51:09 +01: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="\
|
2023-02-14 00:56:22 +00:00
|
|
|
-X tailscale.com/version.longStamp=$VERSION_LONG \
|
|
|
|
-X tailscale.com/version.shortStamp=$VERSION_SHORT \
|
|
|
|
-X tailscale.com/version.gitCommitStamp=$VERSION_GIT_HASH" \
|
2022-10-25 21:12:54 +01:00
|
|
|
-v ./cmd/tailscale ./cmd/tailscaled ./cmd/containerboot
|
2020-02-11 01:50:05 +00:00
|
|
|
|
2022-06-29 15:57:00 +01: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 21:12:54 +01:00
|
|
|
# For compat with the previous run.sh, although ideally you should be
|
|
|
|
# using build_docker.sh which sets an entrypoint for the image.
|
2023-06-14 18:49:18 +01:00
|
|
|
RUN mkdir /tailscale && ln -s /usr/local/bin/containerboot /tailscale/run.sh
|