-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
122 lines (91 loc) · 4.17 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
SHELL=/bin/bash -o pipefail
# Load them from an optional .env file
-include .env
################################################################################
### Config variables
###
# Specify which docker tag is to be used
VERSION := $(or ${VERSION},${VERSION},latest)
DOCKER_REGISTRY := $(or ${DOCKER_REGISTRY},${DOCKER_REGISTRY},docker.io)
TINY = ${VERSION}
MINOR = $(shell echo '${TINY}' | cut -f'1-2' -d'.')
# not used until 1.0
# MAJOR = $(shell echo '${MINOR}' | cut -f'1-2' -d'.')
################################################################################
# Release helpers
#
clean:
rm -rf Dockerfile.*.log Dockerfile.*.built Dockerfile.*.pushed Gemfile.lock **/*/Gemfile.lock
bundle-update:
bundle update
cd examples/restful && bundle update
cd examples/failures && bundle update
bundle-install:
bundle install
cd examples/restful && bundle install
cd examples/failures && bundle install
bundle: bundle-install
install:
rm -rf pkg
bundle exec rake gem
gem install pkg/*.gem
tests: bundle
bundle exec rake
pkg:
make bundle
bundle exec rake gem
gem: pkg
gem.push: gem
gem push `ls -Art pkg/*.gem | tail -n 1`
################################################################################
# Docker images generation rules
#
# builder
Dockerfile.builder.built: Dockerfile.builder $(shell git ls-files .)
docker build -t enspirit/webspicy:builder --file Dockerfile.builder . | tee Dockerfile.builder.log
touch Dockerfile.builder.built
# commandline
Dockerfile.built: Dockerfile.builder.built Dockerfile
docker build -t enspirit/webspicy . | tee Dockerfile.log
touch Dockerfile.built
Dockerfile.pushed: Dockerfile.built
docker tag enspirit/webspicy $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY) | tee -a Dockerfile.log
docker tag enspirit/webspicy $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR) | tee -a Dockerfile.log
touch Dockerfile.pushed
# tester
Dockerfile.tester.built: Dockerfile.built
docker build -t enspirit/webspicy:tester --file Dockerfile.tester . | tee Dockerfile.tester.log
touch Dockerfile.tester.built
Dockerfile.tester.pushed: Dockerfile.tester.built
docker tag enspirit/webspicy:tester $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)-tester;\
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)-tester | tee -a Dockerfile.tester.log;\
docker tag enspirit/webspicy:tester $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)-tester;\
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)-tester | tee -a Dockerfile.tester.log;\
touch Dockerfile.tester.pushed
# mocker
Dockerfile.mocker.built: Dockerfile.built
docker build -t enspirit/webspicy:mocker --file Dockerfile.mocker . | tee Dockerfile.mocker.log
touch Dockerfile.mocker.built
Dockerfile.mocker.pushed: Dockerfile.mocker.built
docker tag enspirit/webspicy:mocker $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)-mocker;\
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)-mocker | tee -a Dockerfile.mocker.log;\
docker tag enspirit/webspicy:mocker $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)-mocker;\
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)-mocker | tee -a Dockerfile.mocker.log;\
touch Dockerfile.mocker.pushed
# inferer
Dockerfile.inferer.built: Dockerfile.built
docker build -t enspirit/webspicy:inferer --file Dockerfile.inferer . | tee Dockerfile.inferer.log
touch Dockerfile.inferer.built
Dockerfile.inferer.pushed: Dockerfile.inferer.built
docker tag enspirit/webspicy:inferer $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)-inferer;\
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(TINY)-inferer | tee -a Dockerfile.inferer.log;\
docker tag enspirit/webspicy:inferer $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)-inferer;\
docker push $(DOCKER_REGISTRY)/enspirit/webspicy:$(MINOR)-inferer | tee -a Dockerfile.inferer.log;\
touch Dockerfile.inferer.pushed
###
jenkins-test: Dockerfile.builder.built
docker run --rm -v ${PWD}/test-results/:/gem/test-results/ enspirit/webspicy:builder
images: Dockerfile.built Dockerfile.tester.built Dockerfile.mocker.built Dockerfile.inferer.built
push-images: Dockerfile.pushed Dockerfile.tester.pushed Dockerfile.mocker.pushed