| 
									
										
										
										
											2023-01-27 13:37:20 -08:00
										 |  |  | # Copyright (c) Tailscale Inc & AUTHORS
 | 
					
						
							|  |  |  | # SPDX-License-Identifier: BSD-3-Clause
 | 
					
						
							| 
									
										
										
										
											2020-02-10 20:50:05 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-06 07:57:47 -07:00
										 |  |  | # This Dockerfile includes all the tailscale binaries.
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # To build the Dockerfile:
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2021-10-16 09:43:25 +02:00
										 |  |  | #     $ docker build -t tailscale/tailscale .
 | 
					
						
							| 
									
										
										
										
											2020-04-06 07:57:47 -07:00
										 |  |  | #
 | 
					
						
							|  |  |  | # To run the tailscaled agent:
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2021-10-16 09:43:25 +02: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 07:57:47 -07:00
										 |  |  | #
 | 
					
						
							|  |  |  | # To then log in:
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #     $ docker exec tailscaled tailscale up
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # To see status:
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #     $ docker exec tailscaled tailscale status
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-07 16:52:30 -08:00
										 |  |  | FROM golang:1.22-alpine AS build-env
 | 
					
						
							| 
									
										
										
										
											2020-02-10 20:50:05 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | WORKDIR /go/src/tailscale
 | 
					
						
							| 
									
										
										
										
											2020-02-14 13:31:14 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-28 23:37:50 +05:30
										 |  |  | COPY go.mod go.sum ./
 | 
					
						
							| 
									
										
										
										
											2020-02-14 13:31:14 -08:00
										 |  |  | RUN go mod download
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-29 07:57:00 -07: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 13:21:30 -04:00
										 |  |  |     github.com/mdlayher/netlink
 | 
					
						
							| 
									
										
										
										
											2022-06-29 07:57:00 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-10 20:50:05 -05:00
										 |  |  | COPY . .
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-19 13:06:07 -08:00
										 |  |  | # see build_docker.sh
 | 
					
						
							| 
									
										
										
										
											2021-03-05 11:51:27 -05: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 13:51:09 +03:00
										 |  |  | ARG TARGETARCH
 | 
					
						
							| 
									
										
										
										
											2021-01-20 11:55:05 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-19 18:14:25 -08:00
										 |  |  | RUN GOARCH=$TARGETARCH go install -ldflags="\
 | 
					
						
							| 
									
										
										
										
											2023-02-13 16:56:22 -08: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 13:12:54 -07:00
										 |  |  |       -v ./cmd/tailscale ./cmd/tailscaled ./cmd/containerboot
 | 
					
						
							| 
									
										
										
										
											2020-02-10 20:50:05 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-11 07:03:18 +00:00
										 |  |  | FROM alpine:3.18
 | 
					
						
							| 
									
										
										
										
											2022-06-29 07:57:00 -07:00
										 |  |  | RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-14 13:31:14 -08:00
										 |  |  | COPY --from=build-env /go/bin/* /usr/local/bin/
 | 
					
						
							| 
									
										
										
										
											2022-10-25 13:12:54 -07: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 13:49:18 -04:00
										 |  |  | RUN mkdir /tailscale && ln -s /usr/local/bin/containerboot /tailscale/run.sh
 |