Skip to content

Enable CGo in Dockerfile builder stage#167

Open
Copilot wants to merge 1 commit intorelease/v2.5.4from
copilot/update-builder-argument-cgo-enabled
Open

Enable CGo in Dockerfile builder stage#167
Copilot wants to merge 1 commit intorelease/v2.5.4from
copilot/update-builder-argument-cgo-enabled

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

The builder stage had CGo disabled (CGO_ENABLED=0), which needs to be enabled for builds requiring C interop.

Change

  • Dockerfile: Set CGO_ENABLED=1 in the builder RUN step
# Before
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build ...

# After
RUN CGO_ENABLED=1 GOOS=linux GOARCH=$TARGETARCH go build ...

Note: With CGo enabled, the resulting binary is dynamically linked. Verify that the distroless/minimal final stage image provides the required C runtime libraries, or ensure dependencies are statically linked.

Co-authored-by: RichardChen820 <99175581+RichardChen820@users.noreply.github.com>
@RichardChen820 RichardChen820 marked this pull request as ready for review March 20, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants