-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (42 loc) · 1.74 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
.PHONY: build-all help environment-check release-all
OWNER:=show0k
# need to list these manually because there's a dependency tree
ALL_STACKS:=alpine-miniconda \
jupyter-docker \
pypot-api \
GIT_MASTER_HEAD_SHA:=$(shell git rev-parse --short=12 --verify HEAD)
help:
@echo
@echo ' build/<stack dirname> - builds the latest image for the stack'
@echo ' dev/<stack dirname> - runs a foreground container for the stack'
@echo ' push/<stack dirname> - pushes the latest and HEAD git SHA tags for the stack to Docker Hub'
@echo ' refresh/<stack dirname> - runs a foreground container for the stack'
@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/%:
docker build $(DARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@)
build-all: $(patsubst %,build/%, $(ALL_STACKS))
dev/%: ARGS?=
dev/%: DARGS?=
dev/%: PORT?=8888
dev/%:
docker run -it --rm -p $(PORT):8888 $(DARGS) $(OWNER)/$(notdir $@) $(ARGS)
environment-check:
test -e ~/.docker-stacks-builder
push/%:
docker push $(OWNER)/$(notdir $@):latest
docker push $(OWNER)/$(notdir $@):$(GIT_MASTER_HEAD_SHA)
refresh/%:
# skip if error: a stack might not be on dockerhub yet
-docker pull $(OWNER)/$(notdir $@):latest
release-all: environment-check \
$(patsubst %,refresh/%, $(ALL_STACKS)) \
$(patsubst %,build/%, $(ALL_STACKS)) \
$(patsubst %,tag/%, $(ALL_STACKS)) \
$(patsubst %,push/%, $(ALL_STACKS))
tag/%:
# always tag the latest build with the git sha
docker tag -f $(OWNER)/$(notdir $@):latest $(OWNER)/$(notdir $@):$(GIT_MASTER_HEAD_SHA)