Files
uberbringer/Dockerfile
T
57_WolveandClaude Opus 5.5 0c88b4ffd5
Security / Vulnerability check (push) Successful in 44s
Test / Lint and test (push) Successful in 2m5s
Add third-party license notices, generated and embedded in the binary
THIRD-PARTY-LICENSES.md holds the license and notice files of the Go
distribution and of the 35 modules that ./cmd/uberbringer links on
linux amd64, armv6, armv7 and arm64, as each distribution ships them.
tools/genlicenses writes it on go generate from go list -deps, so
modules only the tools and tests use stay out. Beside each module's
root license it takes NOTICE files and the license files in its linked
packages' directories, which cover vendored code in gofiber/utils,
klauspost/compress and fasthttp. Each module is listed with its
version, so any dependency change needs the file regenerated. The
generator fails on a module with no license file or a license it does
not recognize.

The same text goes to internal/app/uberbringer/licenses_embed.md, which
the binary embeds and the new `uberbringer licenses` command prints.
The release archives carry the file, and the Docker image keeps it with
LICENSE.txt in /usr/share/licenses/uberbringer/.

The Makefile's openapi and openapi-check targets become generate and
generate-check. They, the CI step and the gate in CLAUDE.md check
docs/swagger.json and both license files, and a test fails when a
committed copy is out of date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:58:39 -06:00

43 lines
1.9 KiB
Docker

# syntax=docker/dockerfile:1
FROM golang:1.27-alpine AS build
# go.mod's go line may name a newer patch release than this image has; the go
# command then downloads that release instead of failing.
ENV GOTOOLCHAIN=auto
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
ARG COMMIT=none
RUN CGO_ENABLED=0 go build -trimpath \
-ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT}" \
-o /out/uberbringer ./cmd/uberbringer
FROM alpine:3.24
# ca-certificates for fetching https images, tzdata for local log times.
# The user and group have the fixed ID 10001, so that files mounted from the
# host, such as an ntfy token file, can be given to it. /var/lib/uberbringer
# holds the state of the ntfy subscriptions; a named volume mounted there
# takes over its owner, so the daemon can write to it.
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -S -g 10001 uberbringer \
&& adduser -S -D -H -u 10001 -G uberbringer -h /etc/uberbringer uberbringer \
&& mkdir -p /var/lib/uberbringer \
&& chown uberbringer:uberbringer /var/lib/uberbringer \
&& chmod 0700 /var/lib/uberbringer
COPY --from=build /out/uberbringer /usr/local/bin/uberbringer
# Where Alpine's own packages keep their license files.
COPY LICENSE.txt THIRD-PARTY-LICENSES.md /usr/share/licenses/uberbringer/
USER uberbringer
WORKDIR /etc/uberbringer
# Plain HTTP for a reverse proxy in front, which terminates TLS. Mount
# config.toml at /etc/uberbringer/config.toml, or set UBERBRINGER_CONFIG to ""
# and give the settings as UBERBRINGER_* variables. Either way, bind_ip must be
# 0.0.0.0 and trusted_proxies must hold the proxy's address. Mount a volume on
# /var/lib/uberbringer to keep the subscriptions' state across containers.
ENV UBERBRINGER_CONFIG=/etc/uberbringer/config.toml \
UBERBRINGER_NTFY_STATE_DIR=/var/lib/uberbringer
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/uberbringer"]