diff --git a/.gitignore b/.gitignore index 74a75f0bbc..c51304c958 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ devmaster_id_rsa.pub bin/* ~bin/devshop !bin/branch-or-tag -!bin/docker-entrypoint +!bin/docker* !bin/hosting-queue-runner !bin/mysql-wait diff --git a/Dockerfile b/Dockerfile index 632409c072..db51dd15d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,6 +73,9 @@ RUN chmod 766 $DEVSHOP_TESTS_ASSETS_PATH RUN ansible --version +# Cleanup unwanted systemd files. See bin/docker-systemd-clean. +RUN docker-systemd-clean + # Remove Home Directory if desired so that devshop code is reinstalled. RUN if [ $DEVSHOP_REBUILD_HOME ]; then rm -rf /var/aegir; fi diff --git a/bin/docker-systemd-clean b/bin/docker-systemd-clean new file mode 100644 index 0000000000..cb4513adda --- /dev/null +++ b/bin/docker-systemd-clean @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e + +devshop-logo "Cleaning up SystemD" +echo "This should only be run inside a container with SystemD." +echo "See https://github.com/geerlingguy/docker-ubuntu1804-ansible/pull/12" + +# @TODO: Make this multi-os, and determine if there are any unwanted side effects. +# The "ls" command should fail, breaking any build without this path. +ls -la /lib/systemd + +find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete; +rm -f /lib/systemd/system/multi-user.target.wants/*; +rm -f /etc/systemd/system/*.wants/*; +rm -f /lib/systemd/system/local-fs.target.wants/*; +rm -f /lib/systemd/system/sockets.target.wants/*udev*; +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; +rm -f /lib/systemd/system/basic.target.wants/*; +rm -f /lib/systemd/system/anaconda.target.wants/*;find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete; \ No newline at end of file