fix: adapt go proxy settings

This commit is contained in:
Markus Pesch 2021-04-09 17:11:51 +02:00
parent 9207833a71
commit 6e6a1cbbb6
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 15 additions and 21 deletions

View File

@ -12,7 +12,9 @@ ARG VERSION
# ================================== # ==================================
FROM ${BUILD_IMAGE} AS build FROM ${BUILD_IMAGE} AS build
COPY . /workspace COPY . /workspace
RUN make ${EXECUTABLE_TARGET} VERSION=${VERSION} GOPROXY=${GOPROXY} GOPRIVATE=${GOPRIVATE} ENV GOPROXY=${GOPROXY}
ENV GOPRIVATE=${GOPRIVATE}
RUN make ${EXECUTABLE_TARGET} VERSION=${VERSION}
# TARGET # TARGET
# ================================== # ==================================

View File

@ -3,14 +3,6 @@
# value is taken. # value is taken.
VERSION?=$(shell git describe --abbrev=0)+$(shell date +'%Y%m%d%H%I%S') VERSION?=$(shell git describe --abbrev=0)+$(shell date +'%Y%m%d%H%I%S')
# GOPROXY settings
# If no GOPROXY environment variable available, the pre-defined GOPROXY from go
# env to download and validate go modules is used. Exclude downloading and
# validation of all private modules which are pre-defined in GOPRIVATE. If no
# GOPRIVATE variable defined, the variable of go env is used.
GOPROXY?=$(shell go env GOPROXY)
GOPRIVATE?=$(shell go env GOPRIVATE)
# CONTAINER_RUNTIME # CONTAINER_RUNTIME
# The CONTAINER_RUNTIME variable will be used to specified the path to a # The CONTAINER_RUNTIME variable will be used to specified the path to a
# container runtime. This is needed to start and run a container images. # container runtime. This is needed to start and run a container images.
@ -34,8 +26,8 @@ bin/linux/amd64/${EXECUTABLE}:
CGO_ENABLED=1 \ CGO_ENABLED=1 \
GOOS=linux \ GOOS=linux \
GOARCH=amd64 \ GOARCH=amd64 \
GOPROXY=${GOPROXY} \ GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=${GOPRIVATE} \ GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
bin/linux/arm/5/${EXECUTABLE}: bin/linux/arm/5/${EXECUTABLE}:
@ -43,8 +35,8 @@ bin/linux/arm/5/${EXECUTABLE}:
GOOS=linux \ GOOS=linux \
GOARCH=arm \ GOARCH=arm \
GOARM=5 \ GOARM=5 \
GOPROXY=${GOPROXY} \ GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=${GOPRIVATE} \ GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
bin/linux/arm/7/${EXECUTABLE}: bin/linux/arm/7/${EXECUTABLE}:
@ -53,14 +45,14 @@ bin/linux/arm/7/${EXECUTABLE}:
GOOS=linux \ GOOS=linux \
GOARCH=arm \ GOARCH=arm \
GOARM=7 \ GOARM=7 \
GOPROXY=${GOPROXY} \ GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=${GOPRIVATE} \ GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
bin/tmp/${EXECUTABLE}: bin/tmp/${EXECUTABLE}:
CGO_ENABLED=1 \ CGO_ENABLED=1 \
GOPROXY=${GOPROXY} \ GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=${GOPRIVATE} \ GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
# CLEAN # CLEAN
@ -87,8 +79,8 @@ container-image/build/amd64:
--build-arg BUILD_IMAGE=docker.io/volkerraschek/build-image:latest \ --build-arg BUILD_IMAGE=docker.io/volkerraschek/build-image:latest \
--build-arg EXECUTABLE=${EXECUTABLE} \ --build-arg EXECUTABLE=${EXECUTABLE} \
--build-arg EXECUTABLE_TARGET=bin/linux/amd64/${EXECUTABLE} \ --build-arg EXECUTABLE_TARGET=bin/linux/amd64/${EXECUTABLE} \
--build-arg GOPROXY=${GOPROXY} \ --build-arg GOPROXY=$(shell go env GOPROXY) \
--build-arg GOPRIVATE=${GOPRIVATE} \ --build-arg GOPRIVATE=$(shell go env GOPRIVATE) \
--build-arg VERSION=${VERSION} \ --build-arg VERSION=${VERSION} \
--file Dockerfile \ --file Dockerfile \
--no-cache \ --no-cache \
@ -136,13 +128,13 @@ container-run/test/unit:
PHONY+=container-run PHONY+=container-run
container-run: container-run:
${CONTAINER_RUNTIME} run \ ${CONTAINER_RUNTIME} run \
--env GOPROXY=$(shell go env GOPROXY) \
--env GOPRIVATE=$(shell go env GOPRIVATE) \
--rm \ --rm \
--volume ${PWD}:/workspace \ --volume ${PWD}:/workspace \
--volume /var/run/docker.sock:/var/run/docker.sock \ --volume /var/run/docker.sock:/var/run/docker.sock \
docker.io/volkerraschek/build-image:latest \ docker.io/volkerraschek/build-image:latest \
make ${COMMAND} \ make ${COMMAND} \
GOPROXY=${GOPROXY} \
GOPRIVATE=${GOPRIVATE} \
VERSION=${VERSION:v%=%} VERSION=${VERSION:v%=%}
# REMOTE # REMOTE