mirror of
https://github.com/juanfont/headscale.git
synced 2026-05-07 19:30:59 +09:00
Add TailscaleRustInContainer (tsric), a Rust-client counterpart to integration/tsic. It runs the axum example from tailscale-rs in a Docker container and exposes the same lifecycle hooks as tsic (Shutdown, SaveLog, Execute, WriteFile) so integration tests can treat it as any other Tailscale node. Dockerfile.tailscale-rs clones tailscale-rs at build time, so no local source checkout is required. The repo URL and ref are Docker build arguments (TAILSCALE_RS_REPO, TAILSCALE_RS_REF) exposed as tsric.WithRepo / tsric.WithRef options. The HEADSCALE_INTEGRATION_ TAILSCALE_RS_IMAGE environment variable provides an escape hatch for using a pre-built image instead of building from source. The Dockerfile patches the cloned root Cargo.toml to expose ts_control's insecure-keyfetch feature through the tailscale crate so the axum example can fetch the control key over plain HTTP. The integration harness serves the control plane without TLS, which is the only mode tailscale-rs can register against until it grows a way to inject a custom CA bundle.
27 lines
958 B
Docker
27 lines
958 B
Docker
FROM rust:1.94-bookworm AS builder
|
|
|
|
ARG TAILSCALE_RS_REPO=https://github.com/tailscale/tailscale-rs.git
|
|
ARG TAILSCALE_RS_REF=main
|
|
|
|
WORKDIR /app
|
|
RUN git clone --depth 1 --branch "$TAILSCALE_RS_REF" "$TAILSCALE_RS_REPO" .
|
|
|
|
# Re-export ts_control's insecure-keyfetch feature through the tailscale
|
|
# crate so the axum example can fetch the headscale control key over
|
|
# plain HTTP. The integration harness serves the control plane without
|
|
# TLS, and upstream only allows plain-HTTP key fetches when this Cargo
|
|
# feature is compiled in.
|
|
RUN sed -i '/^axum = \["dep:axum"\]/a insecure-keyfetch = ["ts_control/insecure-keyfetch"]' Cargo.toml
|
|
|
|
RUN cargo build --release --features axum,insecure-keyfetch --example axum
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
iproute2 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /app/target/release/examples/axum /usr/local/bin/axum
|