Skip to content

Commit

Permalink
Makefile: read proxy setting from multiple environment variables
Browse files Browse the repository at this point in the history
Read proxy setting from following variables: https_proxy, HTTPS_PROXY,
all_proxy and ALL_PROXY. If none of them is set, `--build-arg` will not
be passed to `docker bulid` command.

Signed-off-by: Ning Han <[email protected]>
  • Loading branch information
Ning Han committed Oct 28, 2023
1 parent c96cd27 commit 0fc60c8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
# Copyright (c) 2022 Intel Corporation.

SUBDIRS = $(shell ls -d */)

PROXY :=

ifneq ($(https_proxy),)
PROXY := $(https_proxy)
else ifneq ($(HTTPS_PROXY),)
PROXY := $(HTTPS_PROXY)
else ifneq ($(all_proxy),)
PROXY := $(all_proxy)
else ifneq ($(ALL_PROXY),)
PROXY := $(ALL_PROXY)
endif

all:
@for dir in $(SUBDIRS) ; do \
if [ -f "$$dir/Makefile" ]; then \
Expand Down Expand Up @@ -31,7 +44,7 @@ docker_test:
docker run -it --rm -v $(PWD):/src --name ubuntu_2204_lkvs ubuntu:22.04 make test

docker_image:
docker build --build-arg PROXY=$(https_proxy) -f ./Dockerfile.build -t ubuntu:22.04 .
docker build --build-arg PROXY=$(PROXY) -f ./Dockerfile.build -t ubuntu:22.04 .

docker_make:
docker run -it --rm -v $(PWD):/src -v /lib/modules/`uname -r`:/lib/modules/`uname -r` --name ubuntu_2204_lkvs ubuntu:22.04 make
Expand Down

0 comments on commit 0fc60c8

Please sign in to comment.