Skip to content

Commit

Permalink
add system proxy for docker run (#1335)
Browse files Browse the repository at this point in the history
Signed-off-by: nunu <[email protected]>
  • Loading branch information
gnunu authored Mar 29, 2023
1 parent 6c3cb34 commit 3ee1eff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hack/make-rules/image_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ REGION=${REGION:-}
IMAGE_REPO=${IMAGE_REPO:-"openyurt"}
IMAGE_TAG=${IMAGE_TAG:-$(get_image_tag)}
DOCKER_BUILD_ARGS=""
DOCKER_EXTRA_ENVS=""
BUILD_BASE_IMAGE="golang:1.18"
BUILD_GOPROXY=$(go env GOPROXY)
GOPROXY_CN="https://goproxy.cn"
Expand All @@ -46,10 +47,12 @@ fi

if [[ ! -z ${http_proxy} ]]; then
DOCKER_BUILD_ARGS="${DOCKER_BUILD_ARGS} --build-arg http_proxy=${http_proxy}"
DOCKER_EXTRA_ENVS="--env http_proxy=${http_proxy}"
fi

if [[ ! -z ${https_proxy} ]]; then
DOCKER_BUILD_ARGS="${DOCKER_BUILD_ARGS} --build-arg https_proxy=${https_proxy}"
DOCKER_EXTRA_ENVS="${DOCKER_EXTRA_ENVS=} --env https_proxy=${https_proxy}"
fi

if [[ ! -z ${TARGET_PLATFORMS} ]]; then
Expand All @@ -74,6 +77,7 @@ docker run \
--env GOOS=${TARGETOS} \
--env GOARCH=${TARGETARCH} \
--env GOCACHE=/tmp/ \
${DOCKER_EXTRA_ENVS} \
--user $(id -u ${USER}):$(id -g ${USER}) \
${BUILD_BASE_IMAGE} \
./hack/make-rules/build.sh ${targets[@]}
Expand Down

0 comments on commit 3ee1eff

Please sign in to comment.