forked from jupyter/docker-stacks
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
55 lines (45 loc) · 1.75 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
55
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
.PHONY: build dev help server
OWNER:=jupyter
# need to list these manually because there's a dependency tree
ALL_STACKS:=minimal-kernel \
minimal-notebook \
r-notebook \
scipy-notebook \
datascience-notebook \
pyspark-notebook \
all-spark-notebook
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 $@)
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)