From 88d86374ea8d8c0a1cfcb1b547cefa60ad42c735 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 3 Sep 2025 00:59:11 -0700 Subject: [PATCH] fix: Enable CGO in Docker build for pg_query_go dependency The pg_query_go library requires CGO to be enabled as it wraps the libpg_query C library. Added gcc and musl-dev dependencies to the Docker build for proper compilation. --- test/postgres/Dockerfile.seaweedfs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/postgres/Dockerfile.seaweedfs b/test/postgres/Dockerfile.seaweedfs index 1e4e3a5d8..2b5fe70d6 100644 --- a/test/postgres/Dockerfile.seaweedfs +++ b/test/postgres/Dockerfile.seaweedfs @@ -1,7 +1,7 @@ FROM golang:1.24-alpine AS builder -# Install git and other build dependencies -RUN apk add --no-cache git make +# Install build dependencies including gcc for CGO (required by pg_query_go) +RUN apk add --no-cache git make gcc musl-dev # Set working directory WORKDIR /app @@ -13,8 +13,8 @@ RUN go mod download # Copy source code COPY . . -# Build the weed binary with all our new features -RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o weed ./weed/ +# Build the weed binary with CGO enabled (required for pg_query_go) +RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-s -w" -o weed ./weed/ # Final stage - minimal runtime image FROM alpine:latest