-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (53 loc) · 2.09 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
PERL_VERSION=perl-5.30.3
PERL_VERSION_MODULE_DIR=5.30.3
# heading in green
define log_heading
echo "\n\e[32m-= $(1) =-\n\e[0m"
endef
# we build our own custom perl distribution which is shipped with MyFav.
# To be backward compatible we build on an accient Ubuntu version
myfav_perl_distribution:
$(call log_heading, Building My Favourite Things Perl Distribution Image)
cd myfav_perl_distribution && \
docker build \
--build-arg PERL_VERSION=${PERL_VERSION} \
--build-arg PERL_VERSION_MODULE_DIR=${PERL_VERSION_MODULE_DIR} \
--tag myfav_perl_distribution .
# an image containing a freshly installed MyFav installation.
# start manually via: docker run -p 80:80 -it myfav
# access installer: http://localhost/cgi-bin/MyFavoriteThings/cgi/install.cgi
myfav: myfav_perl_distribution
$(call log_heading, Building My Favourite Things Image)
docker build --tag myfav --file test/Dockerfile.myfav .
# build a test runner and then execute the integration tests.
test: myfav build_test_runner execute_test_runner
build_test_runner:
$(call log_heading, Building Test Runner Image)
cd test && \
docker build --tag myfav_test_runner --file Dockerfile.testrunner .
# runs tests inside the myfav_test_runner image.
# the application is run via the "myfav" container.
# due to --network='host' a Linux system is probably required
execute_test_runner:
$(call log_heading, Executing Tests) && \
docker run \
--network='host' \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
myfav_test_runner
clean:
rm -rf release
docker rm $(shell docker ps -a -q) || true
docker rmi $(shell docker images -f "dangling=true" -q) || true
docker rmi --force myfav
docker rmi --force myfav_test_runner
docker rmi --force myfav_perl_distribution
release: myfav
mkdir -p release
export ID=$$(docker create myfav:latest) && \
docker cp $$ID:/usr/local/apache2/cgi-bin/MyFavoriteThings/ release/ && \
docker rm -v $$ID
rm -rf release/MyFavoriteThings/data
cd release/MyFavoriteThings && \
zip -r ../release-VERSION_NUMBER.zip *
.PHONY: test myfav_perl_distribution release