From 56033240bc54a03bde82d212f026e644b618d208 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Tue, 9 Sep 2025 14:45:24 +0300 Subject: [PATCH] feat: add support for image building with a custom GOPROXY Signed-off-by: Ivan Kolodyazhny --- Dockerfile | 3 +++ Makefile | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 00bf068..9b02de0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,9 @@ # Build the image FROM golang:1.24 as builder +ARG GOPROXY +ENV GOPROXY=$GOPROXY + WORKDIR /workspace # Copy the Go Modules manifests COPY go.mod go.mod diff --git a/Makefile b/Makefile index a0a24f0..7b64c08 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ TARGET_ARCH ?= $(shell go env GOARCH) GO_BUILD_OPTS ?= CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) # Linker flags for go build command GO_LDFLAGS = $(VERSION_LDFLAGS) +GOPROXY ?= PKGS = $(or $(PKG),$(shell cd $(PROJECT_DIR) && go list ./...)) @@ -91,7 +92,7 @@ build: ## Build binary .PHONY: docker-build docker-build: ## Build docker image with ipam binaries - $(DOCKER_CMD) build -t $(IMG) -f $(DOCKERFILE) . + $(DOCKER_CMD) build -t $(IMG) -f $(DOCKERFILE) --build-arg GOPROXY="$(GOPROXY)" . .PHONY: docker-push docker-push: ## Push docker image with ipam binaries