# ─── Stage 1: Build derper ──────────────────────────────────────────── FROM golang:1.24 AS builder WORKDIR /src RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ go install -ldflags="-s -w -extldflags=-static" \ tailscale.com/cmd/derper@main # ─── Stage 2: Final image ──────────────────────────────────────────── FROM alpine:3.14 LABEL maintainer="you@example.com" RUN apk add --no-cache \ bash \ curl \ jq \ openssl \ certbot \ bind-tools \ ca-certificates \ wget \ tar # 工作目录 & 日志目录 WORKDIR /app # 复制 derper 二进制 & 脚本 COPY --from=builder /go/bin/derper /app/derper COPY scripts/ /app/scripts/ RUN chmod +x /app/derper /app/scripts/*.sh