-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (23 loc) · 795 Bytes
/
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
USERNAME = rucas
IMAGE = cryptkeeper
SRCS = $(wildcard */Dockerfile)
SEMVERS = $(patsubst %/Dockerfile,%/VERSION,$(SRCS))
# External Executable Dependencies
EXECUTABLES = git yarn node docker
CHECK := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),,\
$(error "No $(exec) in PATH")))
all: $(SEMVERS)
%/VERSION: %/Dockerfile
# git pull
$(eval $*_version := $(shell ./node_modules/.bin/semver -i patch `head -n 1 $@`))
echo $($*_version) > $@
docker build -t $(USERNAME)/$(IMAGE):$*-latest $*/
# TODO: make this another step
docker tag $(USERNAME)/$(IMAGE):$*-latest $(USERNAME)/$(IMAGE):$*-$($*_version)
docker push $(USERNAME)/$(IMAGE):$*-latest
docker push $(USERNAME)/$(IMAGE):$*-$($*_version)
vars:
@echo SRCS: $(SRCS)
@echo SEMVERS: $(SEMVERS)
.PHONY: vars