From 3671d334471c972372efcf01594f41fdad7530c6 Mon Sep 17 00:00:00 2001 From: John Allberg Date: Sat, 15 Jan 2022 06:25:59 +0100 Subject: [PATCH] Enable setting GOPROXY and GOPRIVATE during build. --- Dockerfile | 4 ++++ Makefile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index fdf296a..fcfb885 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ FROM --platform=${BUILDPLATFORM} ${BUILDER_IMAGE:-golang:1.17.2} as builder ARG TARGETOS ARG TARGETARCH +ARG GOPROXY +ARG GOPRIVATE WORKDIR /workspace @@ -25,6 +27,8 @@ COPY pkg/ pkg/ RUN CGO_ENABLED=0 \ GOOS=${TARGETOS} \ GOARCH=${TARGETARCH} \ + GOPROXY=${GOPROXY} \ + GOPRIVATE=${GOPRIVATE} \ GO111MODULE=on \ go build -mod=mod -a -o manager main.go diff --git a/Makefile b/Makefile index 9a209c3..ad810a1 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ BUILD= GOCMD = go GOFLAGS ?= $(GOFLAGS:) LDFLAGS = +GOPROXY ?= +GOPRIVATE ?= default: build test @@ -39,6 +41,8 @@ build-image: --build-arg GOARCH=$(ARCH) \ --build-arg BUILDER_IMAGE=$(BUILDER_IMAGE) \ --build-arg BASE_IMAGE=${BASE_IMAGE} \ + --build-arg GOPROXY=${GOPROXY} \ + --build-arg GOPRIVATE=${GOPRIVATE} \ -t "${REPOSITORY_ARCH}" \ --load \ -f Dockerfile \