Merge pull request 'dockerfile: use CGO_ENABLED=0 for binary builds (closes #13)' (#21) from fix/cgo-disabled into main
All checks were successful
check / check (push) Successful in 4s

Reviewed-on: #21
This commit was merged in pull request #21.
This commit is contained in:
2026-02-27 08:47:10 +01:00

View File

@@ -14,10 +14,10 @@ COPY . .
# Run all checks — build fails if branch is not green
RUN make check
# Build binaries
# Build static binaries (no cgo needed at runtime — modernc.org/sqlite is pure Go)
ARG VERSION=dev
RUN CGO_ENABLED=1 go build -trimpath -ldflags="-s -w -X main.Version=${VERSION}" -o /chatd ./cmd/chatd/
RUN CGO_ENABLED=1 go build -trimpath -ldflags="-s -w" -o /chat-cli ./cmd/chat-cli/
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X main.Version=${VERSION}" -o /chatd ./cmd/chatd/
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /chat-cli ./cmd/chat-cli/
# alpine:3.21, 2026-02-26
FROM alpine@sha256:c3f8e73fdb79deaebaa2037150150191b9dcbfba68b4a46d70103204c53f4709