Merge pull request #122 from chris060986/master

Allow to build container behind a proxy
This commit is contained in:
Kubernetes Prow Robot 2019-01-23 08:27:10 -08:00 committed by GitHub
commit 95d1059554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -98,6 +98,8 @@ bin/$(OS)_$(ARCH)/$(BIN): build-dirs
-v $$(pwd)/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH) \
-v $$(pwd)/.go/std/$(OS)_$(ARCH):/usr/local/go/pkg/$(OS)_$(ARCH)_static \
-v $$(pwd)/.go/cache:/.cache \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
-w /go/src/$(PKG) \
--rm \
$(BUILD_IMAGE) \
@ -119,7 +121,12 @@ container: .container-$(DOTFILE_IMAGE) container-name
-e 's|{ARG_OS}|$(OS)|g' \
-e 's|{ARG_FROM}|$(BASEIMAGE)|g' \
Dockerfile.in > .dockerfile-$(OS)_$(ARCH)
@docker build -t $(IMAGE):$(TAG) -f .dockerfile-$(OS)_$(ARCH) .
@docker build \
--build-arg HTTP_PROXY=$(HTTP_PROXY) \
--build-arg HTTPS_PROXY=$(HTTPS_PROXY) \
-t $(IMAGE):$(TAG) \
-f .dockerfile-$(OS)_$(ARCH) \
.
@docker images -q $(IMAGE):$(TAG) > $@
container-name:
@ -155,6 +162,8 @@ test: build-dirs
-v $$(pwd)/bin/$(OS)_$(ARCH):/go/bin \
-v $$(pwd)/.go/std/$(OS)_$(ARCH):/usr/local/go/pkg/$(OS)_$(ARCH)_static \
-v $$(pwd)/.go/cache:/.cache \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
-w /go/src/$(PKG) \
$(BUILD_IMAGE) \
/bin/sh -c " \

View File

@ -19,6 +19,9 @@ git-sync can also be configured to make webhook call upon sucessful git repo syn
# build the container
make container REGISTRY=registry VERSION=tag
# build the container behind a proxy
make container REGISTRY=registry VERSION=tag HTTP_PROXY=http://<proxy_address>:<proxy_port> HTTPS_PROXY=https://<proxy_address>:<proxy_port>
# run the container
docker run -d \
-v /tmp/git-data:/tmp/git \