mirror of
https://github.com/Fluent-networks/tailscale-mikrotik.git
synced 2025-06-30 04:24:30 +02:00
Reduce container size. Add steps to use ramdisk to README.md
Strip and compress binaries using upx
This commit is contained in:
parent
aab9d1dd12
commit
82c941c0ec
2 changed files with 26 additions and 2 deletions
|
@ -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
|
||||
|
|
22
README.md
22
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`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue