From 9535a9bed93de691f0418fbe6f7c14b3e760b1d7 Mon Sep 17 00:00:00 2001 From: Jarno Rankinen Date: Mon, 3 Oct 2022 21:43:39 +0300 Subject: [PATCH] Install services, populate mounted empty /var/spool on init --- Dockerfile | 21 +++++++++++++++++++++ mailpod-entrypoint | 7 +++++++ mailpod-entrypoint.service | 9 +++++++++ spool.tar.gz | Bin 0 -> 436 bytes 4 files changed, 37 insertions(+) create mode 100644 Dockerfile create mode 100755 mailpod-entrypoint create mode 100644 mailpod-entrypoint.service create mode 100644 spool.tar.gz diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..54ee087 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM rockylinux:8 +ENV container docker +#RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ +#systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +#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/*; +COPY spool.tar.gz /var/ +RUN dnf install epel-release -y +RUN dnf install postfix dovecot opendkim -y +COPY mailpod-entrypoint /usr/local/bin +COPY mailpod-entrypoint.service /etc/systemd/system/ +RUN systemctl enable mailpod-entrypoint.service +VOLUME [ "/sys/fs/cgroup" ] +#ENTRYPOINT ["/usr/sbin/mailpod-entrypoint"] +CMD ["/usr/sbin/init"] + diff --git a/mailpod-entrypoint b/mailpod-entrypoint new file mode 100755 index 0000000..90734d9 --- /dev/null +++ b/mailpod-entrypoint @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ "$(find /var/spool -maxdepth 0 -empty)" == "/var/spool" ]]; then + pushd /var/spool &> /dev/null + tar xzf ../spool.tar.gz + popd &> /dev/null +fi diff --git a/mailpod-entrypoint.service b/mailpod-entrypoint.service new file mode 100644 index 0000000..9bf5c8b --- /dev/null +++ b/mailpod-entrypoint.service @@ -0,0 +1,9 @@ +[Unit] +Description=Mailpod entrypoint + +[Service] +Type=simple +ExecStart=/usr/local/bin/mailpod-entrypoint + +[Install] +WantedBy=default.target diff --git a/spool.tar.gz b/spool.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..1a268d04e10d27ecfc23f8dff351bcbf028eb985 GIT binary patch literal 436 zcmV;l0ZaZLiwFQ2BRgXN1MQhzZi6rkfH_KUusA>DJPha>4G0RM+VK}yqpp+Mu1L0M z$@db``vonGeA~aG9?x|L@H|DbasXdULFC!eI7)@(lv6_~%@ST!$c- z@}GzDK5Lef|xc_%Mc4hLvS^uSVZtOiu04(q?bL#rPasO4luN~4YV1a)Yt_#UO z0T=#VU15a40{==;-~Tu6f8UJ5VLkZ|0LecE(f`3VD7ioJxPKnTatYHwD~_GtdarT_4Wcf-GwTCdFiG(Q~>#hwU>{(FN~{{PwkyQu$6Qs4hJ z-v8^JITjwL0kok0OG*9z&&KP2KfX7nMC|{;L-jwr0aoV!#q0l29C1GWvt|7so${ZA e=-;~ntNp*of9n4x5{X12fyXzWQ+}BMC;$Kh+UL9g literal 0 HcmV?d00001