mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 06:52:56 +00:00
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
This commit is contained in:
11
Makefile
11
Makefile
@@ -48,9 +48,10 @@ help:
|
||||
|
||||
|
||||
|
||||
build/%: ARGS?=
|
||||
build/%: ## build the latest image for a stack using the system's architecture
|
||||
@echo "::group::Build $(OWNER)/$(notdir $@) (system's architecture)"
|
||||
docker build --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER)
|
||||
docker build $(ARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER)
|
||||
@echo -n "Built image size: "
|
||||
@docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}"
|
||||
@echo "::endgroup::"
|
||||
@@ -96,15 +97,16 @@ build-all: $(foreach I, $(ALL_IMAGES), build/$(I)) ## build all stacks
|
||||
# without needing to update this Makefile, and if all tests succeeds we can
|
||||
# do a publish job that creates a multi-platform image for us.
|
||||
#
|
||||
build/%: ARGS?=
|
||||
build-multi/%: ## build the latest image for a stack on both amd64 and arm64
|
||||
@echo "::group::Build $(OWNER)/$(notdir $@) (system's architecture)"
|
||||
docker buildx build -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --load
|
||||
docker buildx build $(ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --load
|
||||
@echo -n "Built image size: "
|
||||
@docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}"
|
||||
@echo "::endgroup::"
|
||||
|
||||
@echo "::group::Build $(OWNER)/$(notdir $@) (amd64,arm64)"
|
||||
docker buildx build -t build-multi-tmp-cache/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64"
|
||||
docker buildx build $(ARGS) -t build-multi-tmp-cache/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64"
|
||||
@echo "::endgroup::"
|
||||
build-all-multi: $(foreach I, $(MULTI_IMAGES), build-multi/$(I)) $(foreach I, $(AMD64_ONLY_IMAGES), build/$(I)) ## build all stacks
|
||||
|
||||
@@ -181,9 +183,10 @@ push/%: ## push all tags for a jupyter image
|
||||
@echo "::endgroup::"
|
||||
push-all: $(foreach I, $(ALL_IMAGES), push/$(I)) ## push all tagged images
|
||||
|
||||
push-multi/%: ARGS?=
|
||||
push-multi/%: ## push all tags for a jupyter image that support multiple architectures
|
||||
@echo "::group::Push $(OWNER)/$(notdir $@) (amd64,arm64)"
|
||||
docker buildx build $($(subst -,_,$(notdir $@))_EXTRA_TAG_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64" --push
|
||||
docker buildx build $(ARGS) $($(subst -,_,$(notdir $@))_EXTRA_TAG_ARGS) -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) --build-arg OWNER=$(OWNER) --platform "linux/amd64,linux/arm64" --push
|
||||
@echo "::endgroup::"
|
||||
push-all-multi: $(foreach I, $(MULTI_IMAGES), push-multi/$(I)) $(foreach I, $(AMD64_ONLY_IMAGES), push/$(I)) ## push all tagged images
|
||||
|
||||
|
Reference in New Issue
Block a user