From f936dfa35925513e9a661aba10cc1bcb3488b176 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sat, 3 Jan 2026 21:41:59 +0000 Subject: [PATCH] Enable CGO for all GoHoarder binaries to support SQLite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Set CGO_ENABLED=1 for gohoarder main binary in .goreleaser.yaml - Add sqlite-libs and musl to Dockerfile.server - Add sqlite-libs and musl to Dockerfile.scanner All Go binaries that interact with SQLite now have CGO enabled: ✅ gohoarder (main binary) - used by server and scanner ✅ migrate (migration tool) Runtime containers include necessary C libraries: ✅ Dockerfile.server - SQLite runtime support ✅ Dockerfile.scanner - SQLite runtime support ✅ Dockerfile.migrate - SQLite runtime support This fixes: 'Binary was compiled with CGO_ENABLED=0, go-sqlite3 requires cgo' --- .goreleaser.yaml | 2 +- Dockerfile.scanner | 4 +++- Dockerfile.server | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 930407e..a5da755 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -18,7 +18,7 @@ builds: main: ./cmd/gohoarder binary: gohoarder env: - - CGO_ENABLED=0 + - CGO_ENABLED=1 goos: - linux - darwin diff --git a/Dockerfile.scanner b/Dockerfile.scanner index b6dfd90..e88d30a 100644 --- a/Dockerfile.scanner +++ b/Dockerfile.scanner @@ -4,7 +4,7 @@ ARG TARGETARCH FROM alpine:latest -# Install scanning tools and runtime dependencies +# Install scanning tools and runtime dependencies (including CGO/SQLite dependencies) RUN apk add --no-cache \ ca-certificates \ tzdata \ @@ -12,6 +12,8 @@ RUN apk add --no-cache \ curl \ wget \ bash \ + sqlite-libs \ + musl \ && update-ca-certificates # Install Trivy for container scanning diff --git a/Dockerfile.server b/Dockerfile.server index 4e0cabf..a089cce 100644 --- a/Dockerfile.server +++ b/Dockerfile.server @@ -4,10 +4,12 @@ ARG TARGETARCH FROM alpine:latest -# Install runtime dependencies +# Install runtime dependencies (including CGO/SQLite dependencies) RUN apk add --no-cache \ ca-certificates \ tzdata \ + sqlite-libs \ + musl \ && update-ca-certificates # Create non-root user