From f3d6d9d73ed6868c65def983f387916994f8d710 Mon Sep 17 00:00:00 2001 From: Matt Burdan Date: Wed, 27 Mar 2024 13:44:58 +0800 Subject: [PATCH] fix: Propagate CGO_ENABLED environment variable to docker build (#724) * fix: Add ability to statically compile binaries * propagate env var from github action * fix comment --- .github/workflows/docker.yml | 2 ++ Dockerfile | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f0c8a6ba6..909da7c54 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,3 +33,5 @@ jobs: push: false tags: pgweb:latest platforms: linux/amd64,linux/arm64,linux/arm/v7 + build-args: | + "CGO_ENABLED=${{ env.CGO_ENABLED }}" diff --git a/Dockerfile b/Dockerfile index 408e81da3..bb13e1fc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,10 @@ # ------------------------------------------------------------------------------ FROM golang:1.22-bullseye AS build +# Set default build argument for CGO_ENABLED +ARG CGO_ENABLED=0 +ENV CGO_ENABLED ${CGO_ENABLED} + WORKDIR /build RUN git config --global --add safe.directory /build