From 11f3450fe2d9279c7d2ffd998ed2f697c916e24e Mon Sep 17 00:00:00 2001 From: Maik Toepfer Date: Wed, 19 Aug 2020 23:14:02 +0200 Subject: [PATCH] cleanup --- .dockerignore | 1 - Makefile | 50 +++++++++++--------------------------------------- 2 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 35e1d5e..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -build/perlbrew \ No newline at end of file diff --git a/Makefile b/Makefile index 471e9b3..d064f46 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,13 @@ PERL_VERSION=perl-5.30.3 PERL_VERSION_MODULE_DIR=5.30.3 -PERLBREW_ROOT=${PWD}/build/perlbrew - # heading in green define log_heading echo "\n\e[32m-= $(1) =-\n\e[0m" endef -# TODO we need this version homehow installed https://metacpan.org/source/OALDERS/URI-1.76/lib/URI/Escape.pm -# | -# +--> still relevant? -# TODO continue here, use created perl_distribution to run tests +# 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 && \ @@ -20,36 +16,14 @@ myfav_perl_distribution: --build-arg PERL_VERSION_MODULE_DIR=${PERL_VERSION_MODULE_DIR} \ --tag myfav_perl_distribution . -# we build our own Perl distribution to ship it with My Favourite Things. -# To work around issues on older server (too older glibc) we use an accient -# Ubuntu distribution to compile Perl and the modules. -# myfav_perl_distribution: myfav_perl_distribution_build_image -# mkdir -p build/perlbrew -# # -# docker run \ -# --env PERL_VERSION=${PERL_VERSION} \ -# --env PERLBREW_ROOT=/mnt/build/perlbrew \ -# --volume ${PERLBREW_ROOT}:/mnt/build/perlbrew \ -# --volume ${PWD}/myfav_perl_distribution:/mnt/myfav_perl_distribution \ -# --rm \ -# myfav_perl_distribution_builder \ -# /bin/bash -c "cd /mnt/myfav_perl_distribution; make" -# # -# # we need to sudo due to docker uid mapping -# sudo rm -rf build/perl5 -# cp -r ${PERLBREW_ROOT}/perls/${PERL_VERSION} build/perl5 -# # rename module dir from e.g. "lib/5.30.3/" to "lib/provided_version/" -# # this allows stable module paths in the cgi scripts -# find build/perl5 -depth -type d -name '*${PERL_VERSION_MODULE_DIR}*' \ -# -execdir bash -c 'mv "$$1" "$${1/${PERL_VERSION_MODULE_DIR}/provided_version}"' -- {} \; - -# # make module work with DBD::AnyData -# patch `find build/perl5/ -wholename "*/CGI/Application/Plugin/RateLimit.pm"` myfav_perl_distribution/CGI_Application_Plugin_RateLimit.patch - - +# 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: + $(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: build_test_runner execute_test_runner build_test_runner: @@ -57,24 +31,22 @@ build_test_runner: cd test && \ docker build --tag myfav_test_runner --file Dockerfile.testrunner . -# runs tests inside the myfav-test-runner image. +# 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 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 -# TODO check what images are still relevant clean: - sudo rm -rf build 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_builder - docker rmi --force myfav_perl_distribution_builder2 docker rmi --force myfav_perl_distribution .PHONY: test myfav_perl_distribution \ No newline at end of file