From c1103630f035491dbf13c6358c01323c0b09633f Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sat, 3 Jan 2026 21:38:34 +0000 Subject: [PATCH] Enable CGO for migrate binary to support SQLite Changes: - Set CGO_ENABLED=1 for migrate build in .goreleaser.yaml - Add sqlite-libs and musl runtime dependencies to Dockerfile.migrate This fixes the migration error: 'Binary was compiled with CGO_ENABLED=0, go-sqlite3 requires cgo to work' --- .goreleaser.yaml | 2 +- Dockerfile.migrate | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e8a7332..930407e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -36,7 +36,7 @@ builds: main: ./cmd/migrate binary: migrate env: - - CGO_ENABLED=0 + - CGO_ENABLED=1 goos: - linux - darwin diff --git a/Dockerfile.migrate b/Dockerfile.migrate index b5a394e..ea9736d 100644 --- a/Dockerfile.migrate +++ b/Dockerfile.migrate @@ -4,12 +4,14 @@ ARG TARGETARCH FROM alpine:latest -# Install runtime dependencies +# Install runtime dependencies (including CGO/SQLite dependencies) RUN apk add --no-cache \ ca-certificates \ postgresql-client \ mysql-client \ busybox-extras \ + sqlite-libs \ + musl \ && update-ca-certificates # Create non-root user