diff --git a/cmd/build-docker-img/main.go b/cmd/build-docker-img/main.go new file mode 100644 index 00000000000..0d487a6d198 --- /dev/null +++ b/cmd/build-docker-img/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "log" + + "github.com/juanfont/headscale/integration" + "github.com/juanfont/headscale/integration/tsic" + "github.com/ory/dockertest/v3" +) + +func main() { + log.Printf("creating docker pool") + pool, err := dockertest.NewPool("") + if err != nil { + log.Fatalf("could not connect to docker: %s", err) + } + + log.Printf("creating docker network") + network, err := pool.CreateNetwork("docker-integration-net") + if err != nil { + log.Fatalf("failed to create or get network: %s", err) + } + defer network.Close() + defer pool.RemoveContainerByName("docker-integration-net") + + for _, version := range integration.TailscaleVersions { + log.Printf("creating container image for Tailscale (%s)", version) + + tsClient, err := tsic.New( + pool, + version, + network, + ) + if err != nil { + log.Fatalf("failed to create tailscale node: %s", err) + } + + tsClient.Shutdown() + } +}