Trim comments to the non-obvious why
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s

Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 20:49:03 +00:00
co-authored by Claude Opus 5.5
parent effddd2794
commit 4530cb8dc4
222 changed files with 1173 additions and 5423 deletions
+3 -33
View File
@@ -1,32 +1,5 @@
# =============================================================================
# Go backend image — multi-stage: build with the full toolchain, ship a slim
# runtime containing one static binary.
#
# STAGE 1 (golang:1.26)
# go.mod/go.sum are copied and downloaded BEFORE the rest of the source, so
# the dependency layer is cached and only re-runs when the module files
# change — a meaningful saving when building on a Raspberry Pi.
#
# The `--mount=type=cache` lines are BuildKit cache mounts: the module cache
# and the Go build cache persist BETWEEN builds on the host without being
# baked into any image layer. This is the single biggest reason a rebuild on
# the Pi takes minutes rather than much longer. They require BuildKit, which
# is the default in modern `docker compose build`.
#
# CGO_ENABLED=0 produces a fully static binary with no libc dependency, which
# is what lets a golang-built binary run on a different, slimmer base image.
#
# STAGE 2 (debian:bookworm-slim)
# Carries only the binary plus ca-certificates — needed because the backend
# makes outbound HTTPS calls (Spotify, Claude, Steam, the Gitea feed) and
# would fail certificate verification without a trust store.
#
# EXPOSE 8080 is documentation only; the port is never published to the host.
# Caddy reaches it over app-network as BACKEND_HOST:BACKEND_PORT.
#
# Base images are multi-arch, so this builds unchanged on arm64 (the Pi) and
# amd64 (a dev laptop) with no platform pin.
# =============================================================================
# Static binary (CGO_ENABLED=0) on a slim base. ca-certificates for outbound
# HTTPS; the cache mounts keep rebuilds fast.
FROM golang:1.26 AS builder
WORKDIR /backend
@@ -44,10 +17,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
FROM debian:bookworm-slim
# wget is not just for humans: the compose healthcheck probes the server with
# `wget -qO- http://localhost:8080/`, and without it in the image every probe
# fails as "executable file not found" and Docker marks the container
# unhealthy.
# For the compose healthcheck.
RUN apt-get update \
&& apt-get install --yes --no-install-recommends ca-certificates wget \
&& rm -rf /var/lib/apt/lists/*