From f0c4a5bb47526c392de8d23186823b01bcd33ac7 Mon Sep 17 00:00:00 2001 From: clawbot Date: Thu, 26 Feb 2026 22:28:23 -0800 Subject: [PATCH] dockerfile: use CGO_ENABLED=0 for binary builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit modernc.org/sqlite is pure Go — no cgo needed at runtime. build-base remains for make check (-race requires cgo). Fixes #13. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2dd9992..60b0bf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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