mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-13 13:02:56 +00:00
@@ -8,4 +8,4 @@ before_install:
|
|||||||
- make refresh-all
|
- make refresh-all
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make build-all
|
- make build-test-all
|
||||||
|
52
Makefile
52
Makefile
@@ -18,46 +18,60 @@ ALL_IMAGES:=$(ALL_STACKS)
|
|||||||
GIT_MASTER_HEAD_SHA:=$(shell git rev-parse --short=12 --verify HEAD)
|
GIT_MASTER_HEAD_SHA:=$(shell git rev-parse --short=12 --verify HEAD)
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo
|
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||||
@echo ' build/<stack dirname> - builds the latest image for the stack'
|
@echo "jupyter/docker-stacks"
|
||||||
@echo ' dev/<stack dirname> - runs a foreground container for the stack'
|
@echo "====================="
|
||||||
@echo ' push/<stack dirname> - pushes the latest and HEAD git SHA tags for the stack to Docker Hub'
|
@echo "Replace % with a stack directory name (e.g., make build/minimal-notebook)\n"
|
||||||
@echo ' refresh/<stack dirname> - runs a foreground container for the stack'
|
@grep -E '^[a-zA-Z0-9_%/-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
@echo ' release-all - refresh, build, tag, and push all stacks'
|
|
||||||
@echo ' tag/<stack-dirname> - tags the latest stack image with the HEAD git SHA'
|
|
||||||
|
|
||||||
build/%: DARGS?=
|
build/%: DARGS?=
|
||||||
|
build/%: ## build the latest image for a stack
|
||||||
build/%:
|
|
||||||
docker build $(DARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@)
|
docker build $(DARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@)
|
||||||
|
|
||||||
build-all: $(patsubst %,build/%, $(ALL_IMAGES))
|
build-all: $(ALL_IMAGES:%=build/%) ## build all stacks
|
||||||
|
build-test-all: $(foreach I,$(ALL_IMAGES),build/$(I) test/$(I) )
|
||||||
|
|
||||||
dev/%: ARGS?=
|
dev/%: ARGS?=
|
||||||
dev/%: DARGS?=
|
dev/%: DARGS?=
|
||||||
dev/%: PORT?=8888
|
dev/%: PORT?=8888
|
||||||
dev/%:
|
dev/%: ## run a foreground container for a stack
|
||||||
docker run -it --rm -p $(PORT):8888 $(DARGS) $(OWNER)/$(notdir $@) $(ARGS)
|
docker run -it --rm -p $(PORT):8888 $(DARGS) $(OWNER)/$(notdir $@) $(ARGS)
|
||||||
|
|
||||||
environment-check:
|
environment-check:
|
||||||
test -e ~/.docker-stacks-builder
|
test -e ~/.docker-stacks-builder
|
||||||
|
|
||||||
push/%:
|
push/%: ## push the latest and HEAD git SHA tags for a stack to Docker Hub
|
||||||
docker push $(OWNER)/$(notdir $@):latest
|
docker push $(OWNER)/$(notdir $@):latest
|
||||||
docker push $(OWNER)/$(notdir $@):$(GIT_MASTER_HEAD_SHA)
|
docker push $(OWNER)/$(notdir $@):$(GIT_MASTER_HEAD_SHA)
|
||||||
|
|
||||||
push-all: $(patsubst %,push/%, $(ALL_IMAGES))
|
push-all: $(ALL_IMAGES:%=push/%) ## push all stacks
|
||||||
|
|
||||||
refresh/%:
|
refresh/%: ## pull the latest image from Docker Hub for a stack
|
||||||
# skip if error: a stack might not be on dockerhub yet
|
# skip if error: a stack might not be on dockerhub yet
|
||||||
-docker pull $(OWNER)/$(notdir $@):latest
|
-docker pull $(OWNER)/$(notdir $@):latest
|
||||||
|
|
||||||
refresh-all: $(patsubst %,refresh/%, $(ALL_IMAGES))
|
refresh-all: $(ALL_IMAGES:%=refresh/%) ## refresh all stacks
|
||||||
|
|
||||||
release-all: environment-check refresh-all build-all tag-all push-all
|
release-all: environment-check \
|
||||||
|
refresh-all \
|
||||||
|
build-test-all \
|
||||||
|
tag-all \
|
||||||
|
push-all
|
||||||
|
release-all: ## build, test, tag, and push all stacks
|
||||||
|
|
||||||
tag/%:
|
tag/%: ##tag the latest stack image with the HEAD git SHA
|
||||||
# always tag the latest build with the git sha
|
|
||||||
docker tag -f $(OWNER)/$(notdir $@):latest $(OWNER)/$(notdir $@):$(GIT_MASTER_HEAD_SHA)
|
docker tag -f $(OWNER)/$(notdir $@):latest $(OWNER)/$(notdir $@):$(GIT_MASTER_HEAD_SHA)
|
||||||
|
|
||||||
tag-all: $(patsubst %,tag/%, $(ALL_IMAGES))
|
tag-all: $(ALL_IMAGES:%=tag/%) ## tag all stacks
|
||||||
|
|
||||||
|
test/%: ## run a stack container, check for jupyter server liveliness
|
||||||
|
@-docker rm -f iut
|
||||||
|
docker run -d --name iut $(OWNER)/$(notdir $@)
|
||||||
|
@for i in $$(seq 0 9); do \
|
||||||
|
sleep $$i; \
|
||||||
|
docker exec iut bash -c 'wget http://localhost:8888 -O- | grep -i jupyter'; \
|
||||||
|
if [[ $$? == 0 ]]; then break; fi; \
|
||||||
|
done
|
||||||
|
@docker rm -f iut
|
||||||
|
|
||||||
|
test-all: $(ALL_IMAGES:%=test/%) ## test all stacks
|
||||||
|
Reference in New Issue
Block a user