diff --git a/Dockerfile b/Dockerfile index 1675888..d47d65b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,8 @@ WORKDIR /go/src/tailscale COPY tailscale/go.mod tailscale/go.sum ./ RUN go mod download +RUN apk add --no-cache upx + # Pre-build some stuff before the following COPY line invalidates the Docker cache. RUN go install \ github.com/aws/aws-sdk-go-v2/aws \ @@ -48,12 +50,14 @@ ARG VERSION_GIT_HASH="" ENV VERSION_GIT_HASH=$VERSION_GIT_HASH ARG TARGETARCH -RUN GOARCH=$TARGETARCH go install -ldflags="\ +RUN GOARCH=$TARGETARCH go install -ldflags="-w -s\ -X tailscale.com/version.Long=$VERSION_LONG \ -X tailscale.com/version.Short=$VERSION_SHORT \ -X tailscale.com/version.GitCommit=$VERSION_GIT_HASH" \ -v ./cmd/tailscale ./cmd/tailscaled +RUN upx /go/bin/tailscale && upx /go/bin/tailscaled + FROM alpine:3.18 RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables bash openssh curl jq diff --git a/README.md b/README.md index f74d03a..a3557bc 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ add name="tailscale" src="/tailscale" dst="/var/lib/tailscale" 6. Create the container -The container can be created via the container registry (Step 6a) or using the `tailscale.tar` file generated by building the Docker image locally (Step 6b). +The container can be created via the container registry (Step 6a) or using the `tailscale.tar` file generated by building the Docker image locally (Step 6b or 6c). 6a. Container registry @@ -130,6 +130,26 @@ Using the file `tailscale.tar` generated by running `build.sh`, upload the file If you want to see the container output in the router log add `logging=yes` to the container add command. +6b. Tar archive file (routers without external storage) + +For routers without USB port (tested on hAP ax2) it's possible to use ramdisk to temporary store `tailscale.tar` file. + +Firstly make sure that there is no old version of container installed. Firstly create `tmpfs` disk: + +``` +/disk add type=tmpfs tmpfs-max-size=200M +``` +Upload `tailscale.tar` file to `tmp1/` disk (or move it after uploading to root folder) + +Then start container like in 6b: + +``` +/container add file=tmp1/tailscale.tar interface=veth1 envlist=tailscale root-dir=containers/tailscale mounts=tailscale start-on-boot=yes hostname=mikrotik dns=8.8.4.4,8.8.8.8 +``` + +Router will unpack tarball to internal storage. Once container is created it's ok to remove tarball from `tmpfs`. Also, +container will be preserved after router reboot. + ### Start the Container Ensure the container has been extracted and added by verifying `status=stopped` using `/container/print`