Added example compose for a tailscale deployment
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
# Build stage. Runs on the runner's native arch (BUILDPLATFORM) and
|
||||
# cross-compiles the Go binary for whichever target the manifest list
|
||||
# is being assembled for (TARGETOS/TARGETARCH). Keeps multi-arch
|
||||
# builds fast — only the final link is per-arch, the Go toolchain is
|
||||
# always native.
|
||||
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG VERSION=dev
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Module cache layer — re-uses unless go.mod/go.sum change.
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
||||
go build \
|
||||
-trimpath \
|
||||
-ldflags "-s -w -X main.version=${VERSION}" \
|
||||
-o /out/qu \
|
||||
./cmd/qu
|
||||
|
||||
# Runtime stage. distroless/static has CA roots for HTTPS probes and
|
||||
# nothing else — no shell, no package manager. Runs as root so the
|
||||
# daemon can open ICMP sockets and write under /etc/quptime; operators
|
||||
# can override at deploy time with `docker run --user`.
|
||||
FROM gcr.io/distroless/static-debian12:latest
|
||||
|
||||
COPY --from=builder /out/qu /usr/local/bin/qu
|
||||
|
||||
ENV QUPTIME_DIR=/etc/quptime
|
||||
VOLUME ["/etc/quptime"]
|
||||
EXPOSE 9901
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/qu"]
|
||||
CMD ["serve"]
|
||||
@@ -0,0 +1,37 @@
|
||||
# An example of a docker compose with Tailscale & QUptime.
|
||||
# This setup is specifically intended for hosts that may not be able to reach each other directly or have a public IP address.
|
||||
|
||||
services:
|
||||
tailscale:
|
||||
image: tailscale/tailscale:latest
|
||||
container_name: tailscale
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
environment:
|
||||
- TS_AUTHKEY=${TAILSCALE_AUTHKEY} # Set this in your .env file with a Tailscale auth key
|
||||
- TS_HOSTNAME=quptime-tailscale
|
||||
volumes:
|
||||
- /dev/net/tun:/dev/net/tun
|
||||
- tailscale:/var/lib/tailscale
|
||||
restart: unless-stopped
|
||||
|
||||
quptime:
|
||||
image: git.cer.sh/axodouble/quptime:master
|
||||
container_name: quptime
|
||||
volumes:
|
||||
- quptime:/etc/quptime
|
||||
ports:
|
||||
- "9901:9901"
|
||||
depends_on:
|
||||
- tailscale
|
||||
# No restart directive, user needs to init quptime first
|
||||
# Run `docker compose -f docker-compose-tailscale.yml run --rm quptime init` to initialize
|
||||
# the data volume before starting the service
|
||||
# If this is not the master node, use
|
||||
# `docker compose -f docker-compose-tailscale.yml run --rm quptime --advertise <TAILSCALE_IP>:9901 --secret <SECRET>`
|
||||
# And add the individual nodes to the cluster with `docker compose -f docker-compose-tailscale.yml run --rm quptime node add <OTHER_NODE_IP>:9901`
|
||||
network_mode: "service:tailscale" # Use the Tailscale network stack
|
||||
|
||||
volumes:
|
||||
tailscale:
|
||||
quptime:
|
||||
Reference in New Issue
Block a user