# gadfly-reports daemon image. modernc.org/sqlite is pure Go, so the binary is # CGO-free and the final image needs no libc / no C toolchain at build time. FROM golang:1.26 AS build WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/gadfly-reports . FROM alpine:3.20 RUN adduser -D -u 10001 app && mkdir -p /data && chown app /data COPY --from=build /out/gadfly-reports /usr/local/bin/gadfly-reports USER app ENV GADFLY_REPORTS_ADDR=:8090 \ GADFLY_REPORTS_DB=/data/gadfly-reports.db EXPOSE 8090 VOLUME ["/data"] # Fast probe so an orchestrator (e.g. Traefik) resumes routing within a few seconds # of a (re)start — the daemon binds the port in milliseconds. First probe at # --interval (5s); --start-period keeps early failures from flapping the status. HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=3 \ CMD wget -q -O - http://localhost:8090/healthz || exit 1 ENTRYPOINT ["/usr/local/bin/gadfly-reports"] CMD ["serve"]