Refactor Dockerfile #2

Merged
ElZeckos merged 1 commit from ft/dockerfile into main 2026-05-17 12:33:12 +02:00
Collaborator

Builder stage: Compile Go binary with CGO enabled and static linking (using gcc, musl-dev, sqlite-dev)
Significantly reduces final image size

Builder stage: Compile Go binary with CGO enabled and static linking (using gcc, musl-dev, sqlite-dev) Significantly reduces final image size
phil self-assigned this 2026-05-17 10:30:00 +02:00
phil requested review from ElZeckos 2026-05-17 10:30:04 +02:00
ElZeckos force-pushed ft/dockerfile from 45897a89eb to 01561f4aa8
All checks were successful
ci/woodpecker/pr/0-check Pipeline was successful
ci/woodpecker/pr/10-pr-review Pipeline was successful
2026-05-17 12:31:43 +02:00
Compare
Collaborator

Summary: Refactors the Dockerfile from a single-stage Alpine image to a multi-stage build producing a minimal scratch image with a statically-linked Go binary.

Issues: None blocking, but note one change worth awareness:

💡 LOW - Dockerfile:5 - Undocumented Go version upgrade

The Go version was upgraded from 1.24.2-alpine to 1.26-alpine. While Go maintains backward compatibility, this skips versions 1.25. Consider verifying compatibility or documenting this upgrade rationale.

Recommendations:

💡 Dockerfile - Optional improvements

Step 1: If the application uses time zones (e.g., time.LoadLocation()), add timezone data:

COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
ENV TZ=/usr/share/zoneinfo

Step 2: Consider pinning the exact Alpine version for reproducibility:
FROM golang:1.26-alpine3.19 AS builder

Score (Code Quality): 88

Result: 👍 Good

The multi-stage build approach is a solid improvement—static linking combined with a scratch base significantly reduces image size and attack surface. The CA certificates are correctly included for TLS functionality. The Go version upgrade (1.24.2 → 1.26) should work but warrants a quick compatibility check.

**Summary:** Refactors the Dockerfile from a single-stage Alpine image to a multi-stage build producing a minimal scratch image with a statically-linked Go binary. **Issues:** None blocking, but note one change worth awareness: <details> <summary>💡 LOW - Dockerfile:5 - Undocumented Go version upgrade</summary> > The Go version was upgraded from `1.24.2-alpine` to `1.26-alpine`. While Go maintains backward compatibility, this skips versions 1.25. Consider verifying compatibility or documenting this upgrade rationale. </details> **Recommendations:** <details> <summary>💡 Dockerfile - Optional improvements</summary> > **Step 1:** If the application uses time zones (e.g., `time.LoadLocation()`), add timezone data: > ``` > COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo > ENV TZ=/usr/share/zoneinfo > ``` > > **Step 2:** Consider pinning the exact Alpine version for reproducibility: > `FROM golang:1.26-alpine3.19 AS builder` </details> **Score (Code Quality):** 88 **Result:** 👍 Good The multi-stage build approach is a solid improvement—static linking combined with a scratch base significantly reduces image size and attack surface. The CA certificates are correctly included for TLS functionality. The Go version upgrade (1.24.2 → 1.26) should work but warrants a quick compatibility check.
ElZeckos deleted branch ft/dockerfile 2026-05-17 12:33:12 +02:00
Sign in to join this conversation.
No description provided.