dockerfile: use CGO_ENABLED=0 for binary builds
All checks were successful
check / check (push) Successful in 5s

modernc.org/sqlite is pure Go — no cgo needed at runtime.
build-base remains for make check (-race requires cgo).
Fixes #13.
This commit is contained in:
clawbot 2026-02-26 22:28:23 -08:00
parent cbc93473fc
commit f0c4a5bb47

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