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.
This commit is contained in:
chrislu
2025-09-03 00:59:11 -07:00
parent 4d9de40c5c
commit 88d86374ea
+4 -4
View File
@@ -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