Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (35 loc) · 1.88 KB
/
Copy pathDockerfile
File metadata and controls
42 lines (35 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# syntax=docker/dockerfile:1.7
# --- Build backend ---
# The frontend is server-rendered by the Go binary (html/template + HTMX, assets embedded),
# so there is no Node/Vite build stage as of v2.0.0 — the whole JS toolchain is gone.
FROM golang:1.26-alpine AS api-build
WORKDIR /src
RUN apk add --no-cache git
COPY api/go.mod ./api/go.mod
RUN cd api && go mod download
COPY api ./api
RUN cd api && CGO_ENABLED=0 go build -ldflags='-s -w' -o /out/patchdeck ./cmd/server
# --- Final runtime image ---
# Plain Alpine — no python/Apprise. Notifications are delivered natively by the Go
# binary, so the runtime carries no interpreter (and none of its CVE surface).
FROM alpine:3.22
WORKDIR /app
# ca-certificates: outbound HTTPS for notifications. su-exec: privilege drop in the
# entrypoint. `apk upgrade` pulls the latest patched base packages (e.g. libcrypto3) so a
# stale base-image snapshot can't carry a fixable CVE past the CI security gate.
# The patchdeck user is created here; the entrypoint adjusts UID/GID at runtime.
RUN apk upgrade --no-cache \
&& apk add --no-cache ca-certificates su-exec \
&& addgroup -g 1000 patchdeck \
&& adduser -D -H -u 1000 -G patchdeck patchdeck \
&& mkdir -p /data && chown patchdeck:patchdeck /data
COPY --from=api-build /out/patchdeck /app/patchdeck
COPY entrypoint.sh /app/entrypoint.sh
EXPOSE 6070
# Baked-in healthcheck: the binary probes its own /healthz over loopback in whichever mode it
# serves (plain HTTP, or the self-signed HTTPS default), so no curl/wget is needed in the image and
# a generic probe can't false-fail on the cert. start-interval polls quickly while booting so a
# health-aware proxy (Traefik skips non-healthy containers) routes it within seconds of a restart.
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=30s --start-interval=2s \
CMD ["/app/patchdeck", "healthcheck"]
ENTRYPOINT ["/app/entrypoint.sh"]