From fd108e684b4300a154d196a15f375b55d413c53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Djema=C3=AF?= <53857555+SamyDjemai@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:16:26 +0100 Subject: [PATCH] docs: add Docker image doc to README.md --- README.md | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eed93a7..19fbeed 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Tailscale routes manager **tailscale-manager** dynamically manages Tailscale subnet route advertisements -based on user-configurable discovery sources. It runs alongside tailscaled on +based on user-configurable discovery sources. It runs alongside tailscaled on the node(s) where you want to advertise routes. ## Supported discovery methods | config keyword | example | description | -|:------------------------|:------------------------------|:---------------------------| +| :---------------------- | :---------------------------- | :------------------------- | | `routes` | `["192.168.0.0/24"]` | Static routes | | `hostRoutes` | `["private-app.example.com"]` | DNS hostname lookup | | `awsManagedPrefixLists` | `["pl-02761f4a40454a3c9"]` | [AWS Managed Prefix Lists] | @@ -16,7 +16,7 @@ the node(s) where you want to advertise routes. `hostRoutes` can be used to emulate [Tailscale App Connectors] by advertising a set of individual IP address routes that are kept in sync with DNS lookups of a -set of hostnames. This is most useful when using [Headscale], which doesn't +set of hostnames. This is most useful when using [Headscale], which doesn't normally support App Connectors. [Tailscale App Connectors]: https://tailscale.com/kb/1281/app-connectors @@ -104,11 +104,39 @@ Available options: -h,--help Show this help text ``` +## Docker image + +A Docker image is built and pushed to GitHub Container Registry on each version, commit, and pull request. The image is built based on Alpine images and contains a statically-linked `tailscale-manager` binary. + +You can use it to build your own custom Tailscale Docker images using the following Dockerfile and `entrypoint.sh` script. + +```dockerfile +# Dockerfile +FROM ghcr.io/singlestore-labs/tailscale-manager AS tailscale-manager +FROM tailscale/tailscale AS tailscale + +COPY --from=tailscale-manager /bin/tailscale-manager /bin/tailscale-manager + +COPY config.json + +COPY entrypoint.sh /usr/local/bin/entrypoint +CMD ["entrypoint"] +``` + +```sh +# entrypoint.sh +#!/bin/sh +tailscale-manager --interval 300 & +containerboot +``` + +This will allow you to use Tailscale as a Docker container while having `tailscale-manager` running in the background, periodically updating routes. + ## NixOS module -If you use NixOS, this repository provides a flake with a NixOS module to install and run tailscale-manager as a systemd service. You can incorporate it into your flake.nix like so: +If you use NixOS, this repository provides a flake with a NixOS module to install and run tailscale-manager as a systemd service. You can incorporate it into your flake.nix like so: -``` nix +```nix { description = "my nixos config";