Files
urutau/Dockerfile
T
Lucas RayanandClaude Opus 5.5 8546d14cef
CI / Format and vet (pull_request) Failing after 53s
CI / Dependency audit (pull_request) Successful in 33s
CI / Tests (Linux, race detector) (pull_request) Successful in 2m1s
CI / Docker images (build and smoke test) (pull_request) Failing after 47s
feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that
tails the logs, ships raw lines to the hub over HTTPS with an on-disk
spool, and applies enforce decisions locally. The hub keeps one node per
probe (primary node = the 1.x data dir, unchanged), does all analysis and
serves the UI. Peer federation is removed. 'urutau import' brings 1.x
data dirs in with hash and count verification. UI: probes page, host
qualified incidents, IPs never wrap, egress heatmap labels, live and
replay globes no longer auto-rotate, replay repeat, live traffic metrics.

BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone;
log path variables move from the hub to the probe. See docs/migration-2.0.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:14:50 -03:00

71 lines
3.1 KiB
Docker

# syntax=docker/dockerfile:1
#
# Urutau 2: one static binary (no CGO, standard library only), two images.
# --target hub the hub: dashboard, API, probe ingestion (Alpine)
# --target probe the probe: `urutau probe` only (FROM scratch, a few MB)
# The default (last) stage is the hub, so a plain `docker build .` is the hub.
# Build stage.
FROM golang:1.26.11-alpine3.24 AS build
WORKDIR /src
COPY go.mod ./
COPY cmd cmd
COPY internal internal
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/urutau ./cmd/urutau
# Files the scratch image needs: CA certificates (HTTPS to the hub), zoneinfo
# (TZ must match the host's fail2ban log) and an owned empty /state.
FROM alpine:3.24 AS probe-files
RUN apk add --no-cache ca-certificates tzdata \
&& mkdir -p /rootfs/state \
&& chown 10001:10001 /rootfs/state
# Probe image: no shell, no package manager, no listening port. It reads the
# host logs (read-only mounts), sends them to the hub over HTTPS and appends the
# hub's ban decisions to a file. The HEALTHCHECK is the binary itself
# (`urutau probe --check` reads the liveness mark in the state volume).
# Runs unprivileged (uid 10001); the compose file adds the host group adm
# (`group_add: ["4"]`) to read /var/log.
FROM scratch AS probe
COPY --from=probe-files /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=probe-files /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=probe-files --chown=10001:10001 /rootfs/state /state
COPY --from=build /out/urutau /urutau
LABEL org.opencontainers.image.title="Urutau probe" \
org.opencontainers.image.description="Ultra-light Urutau probe: ships host logs to an Urutau hub" \
org.opencontainers.image.source="https://git.lucasrguerra.dev.br/ciberfauna/urutau" \
org.opencontainers.image.licenses="MIT OR Apache-2.0"
ENV URUTAU_STATE_DIR=/state \
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
ZONEINFO=/usr/share/zoneinfo
USER 10001:10001
VOLUME /state
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD ["/urutau", "probe", "--check"]
ENTRYPOINT ["/urutau", "probe"]
# Hub image: CA certificates (hub-to-hub downloads: geo database, Tor lists) and
# tzdata. The HEALTHCHECK is the binary itself (`urutau healthcheck`): no curl in
# the image. The hub reads no log file: the probes bring the lines.
FROM alpine:3.24 AS hub
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -S -g 10001 urutau \
&& adduser -S -u 10001 -G urutau -h /data -s /sbin/nologin urutau \
&& mkdir -p /data \
&& chown urutau:urutau /data
COPY --from=build /out/urutau /usr/local/bin/urutau
LABEL org.opencontainers.image.title="Urutau" \
org.opencontainers.image.description="Lightweight, always-on threat intelligence for self-hosted servers" \
org.opencontainers.image.source="https://git.lucasrguerra.dev.br/ciberfauna/urutau" \
org.opencontainers.image.licenses="MIT OR Apache-2.0"
ENV URUTAU_BIND=0.0.0.0:8790 \
URUTAU_DATA_DIR=/data
USER urutau
WORKDIR /data
VOLUME /data
EXPOSE 8790
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD ["urutau", "healthcheck"]
ENTRYPOINT ["urutau"]
CMD ["serve"]