Skip to content

Commit 6aab2f9

Browse files
authored
Merge pull request #1501 from PuckCh/build-fix-makefile
Re-add build option to be enable some kind of custom builds
2 parents 82ce737 + 13415a6 commit 6aab2f9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ help:
4848

4949

5050

51+
build/%: DOCKER_BUILD_ARGS?=
5152
build/%: ## build the latest image for a stack using the system's architecture
5253
@echo "::group::Build $(OWNER)/$(notdir $@) (system's architecture)"
53-
docker build --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER)
54+
docker build $(DOCKER_BUILD_ARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER)
5455
@echo -n "Built image size: "
5556
@docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}"
5657
@echo "::endgroup::"
@@ -96,15 +97,16 @@ build-all: $(foreach I, $(ALL_IMAGES), build/$(I)) ## build all stacks
9697
# without needing to update this Makefile, and if all tests succeeds we can
9798
# do a publish job that creates a multi-platform image for us.
9899
#
100+
build-multi/%: DOCKER_BUILD_ARGS?=
99101
build-multi/%: ## build the latest image for a stack on both amd64 and arm64
100102
@echo "::group::Build $(OWNER)/$(notdir $@) (system's architecture)"
101-
docker buildx build -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --load
103+
docker buildx build $(DOCKER_BUILD_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --load
102104
@echo -n "Built image size: "
103105
@docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}"
104106
@echo "::endgroup::"
105107

106108
@echo "::group::Build $(OWNER)/$(notdir $@) (amd64,arm64)"
107-
docker buildx build -t build-multi-tmp-cache/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64"
109+
docker buildx build $(DOCKER_BUILD_ARGS) -t build-multi-tmp-cache/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64"
108110
@echo "::endgroup::"
109111
build-all-multi: $(foreach I, $(MULTI_IMAGES), build-multi/$(I)) $(foreach I, $(AMD64_ONLY_IMAGES), build/$(I)) ## build all stacks
110112

@@ -181,9 +183,10 @@ push/%: ## push all tags for a jupyter image
181183
@echo "::endgroup::"
182184
push-all: $(foreach I, $(ALL_IMAGES), push/$(I)) ## push all tagged images
183185

186+
push-multi/%: DOCKER_BUILD_ARGS?=
184187
push-multi/%: ## push all tags for a jupyter image that support multiple architectures
185188
@echo "::group::Push $(OWNER)/$(notdir $@) (amd64,arm64)"
186-
docker buildx build $($(subst -,_,$(notdir $@))_EXTRA_TAG_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64" --push
189+
docker buildx build $(DOCKER_BUILD_ARGS) $($(subst -,_,$(notdir $@))_EXTRA_TAG_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64" --push
187190
@echo "::endgroup::"
188191
push-all-multi: $(foreach I, $(MULTI_IMAGES), push-multi/$(I)) $(foreach I, $(AMD64_ONLY_IMAGES), push/$(I)) ## push all tagged images
189192

0 commit comments

Comments
 (0)