Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Maik Toepfer committed Aug 19, 2020
1 parent e79c0cf commit 11f3450
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 40 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

50 changes: 11 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -20,61 +16,37 @@ 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:
$(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.
# 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

0 comments on commit 11f3450

Please sign in to comment.