Skip to content

Commit e25f68d

Browse files
committed
Re-add build option to be enable some kind of custom builds
For example, with: $ BASE_CONTAINER=ubuntu:focal-20211006@sha256:26c3bd3ae441c873a210200bcbb975ffd2bbf0c0841a4584f4476c8a5b8f3d99 $ NB_UID=1234 $ make build/base-notebook \ ARGS="--build-arg BASE_CONTAINER=$BASE_CONTAINER --build-arg NB_USER=$NB_USER_TEACHER --build-arg NB_UID=$NB_UID" we could generate base-notebook using a specific base image and where jovyan is uid 1234 instead of 1000
1 parent 82ce737 commit e25f68d

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/%: 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 $(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/%: 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 $(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 $(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/%: 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 $(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)