Cleanup Makefile, allow cache use, and allow extra args
Change-Id: I7ded3a1c95151f898e00f6168d0c90938e17b0e6
This commit is contained in:
parent
3accf71685
commit
2746d04402
33
Makefile
33
Makefile
@ -35,6 +35,20 @@ HELM := $(BUILD_DIR)/helm
|
|||||||
SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/stable/"
|
SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/stable/"
|
||||||
SSTREAM_RELEASE := "bionic"
|
SSTREAM_RELEASE := "bionic"
|
||||||
UBUNTU_BASE_IMAGE ?= ubuntu:18.04
|
UBUNTU_BASE_IMAGE ?= ubuntu:18.04
|
||||||
|
USE_CACHED_IMG ?= false
|
||||||
|
DOCKER_EXTRA_ARGS ?=
|
||||||
|
|
||||||
|
ifeq ($(USE_CACHED_IMG), true)
|
||||||
|
DOCKER_EXTRA_ARGS += --build-arg BUILDKIT_INLINE_CACHE=1
|
||||||
|
else
|
||||||
|
DOCKER_EXTRA_ARGS += --pull --no-cache --build-arg BUILDKIT_INLINE_CACHE=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(USE_PROXY), true)
|
||||||
|
DOCKER_EXTRA_ARGS += --build-arg "http_proxy=$(PROXY)" --build-arg "https_proxy=$(PROXY)"
|
||||||
|
DOCKER_EXTRA_ARGS += --build-arg "HTTP_PROXY=$(PROXY)" --build-arg "HTTPS_PROXY=$(PROXY)"
|
||||||
|
DOCKER_EXTRA_ARGS += --build-arg "no_proxy=$(NO_PROXY)" --build-arg "NO_PROXY=$(NO_PROXY)"
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: images
|
.PHONY: images
|
||||||
#Build all images in the list
|
#Build all images in the list
|
||||||
@ -69,33 +83,16 @@ helm-install:
|
|||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
ifeq ($(USE_PROXY), true)
|
|
||||||
docker build -t $(IMAGE) --label $(LABEL) --network=host \
|
|
||||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
|
||||||
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
|
|
||||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
|
||||||
-f $(IMAGE_DIR)/Dockerfile \
|
|
||||||
--build-arg FROM=$(UBUNTU_BASE_IMAGE) \
|
|
||||||
--build-arg http_proxy=$(PROXY) \
|
|
||||||
--build-arg https_proxy=$(PROXY) \
|
|
||||||
--build-arg HTTP_PROXY=$(PROXY) \
|
|
||||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
|
||||||
--build-arg no_proxy=$(NO_PROXY) \
|
|
||||||
--build-arg NO_PROXY=$(NO_PROXY) \
|
|
||||||
--build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
|
|
||||||
--build-arg SSTREAM_RELEASE=$(SSTREAM_RELEASE) \
|
|
||||||
$(IMAGE_DIR)
|
|
||||||
else
|
|
||||||
docker build -t $(IMAGE) --label $(LABEL) --network=host \
|
docker build -t $(IMAGE) --label $(LABEL) --network=host \
|
||||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||||
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
|
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
|
||||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||||
-f $(IMAGE_DIR)/Dockerfile \
|
-f $(IMAGE_DIR)/Dockerfile \
|
||||||
|
$(DOCKER_EXTRA_ARGS) \
|
||||||
--build-arg FROM=$(UBUNTU_BASE_IMAGE) \
|
--build-arg FROM=$(UBUNTU_BASE_IMAGE) \
|
||||||
--build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
|
--build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
|
||||||
--build-arg SSTREAM_RELEASE=$(SSTREAM_RELEASE) \
|
--build-arg SSTREAM_RELEASE=$(SSTREAM_RELEASE) \
|
||||||
$(IMAGE_DIR)
|
$(IMAGE_DIR)
|
||||||
endif
|
|
||||||
ifeq ($(PUSH_IMAGE), true)
|
ifeq ($(PUSH_IMAGE), true)
|
||||||
docker push $(IMAGE)
|
docker push $(IMAGE)
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user