From 628492c48120fe03949a743befcf76d0074a49ac Mon Sep 17 00:00:00 2001 From: Blallo Date: Fri, 17 Aug 2018 18:09:41 +0200 Subject: [PATCH] [d] Fix messy Dockerfile-tt-rss --- docker/Dockerfile-tt-rss | 49 +++++++++++++++++++++------------------- docker/setup_openrc.sh | 22 ++++++++++++++++++ 2 files changed, 48 insertions(+), 23 deletions(-) create mode 100755 docker/setup_openrc.sh diff --git a/docker/Dockerfile-tt-rss b/docker/Dockerfile-tt-rss index c3b9db0..6a743b7 100644 --- a/docker/Dockerfile-tt-rss +++ b/docker/Dockerfile-tt-rss @@ -1,33 +1,36 @@ FROM ulsmith/alpine-apache-php7 -RUN apk update && apk upgrade && apk add util-linux php7-pgsql php7-fileinfo openrc postgresql-client && apk del php7-pdo_mysql php7-pdo_odbc php7-pdo_sqlite db php7-redis php7-ftp && rm -rf /var/cache/apk/ + +RUN apk add --update \ + php7-pgsql \ + php7-fileinfo \ + openrc \ + postgresql-client \ + && apk del \ + php7-pdo_mysql \ + php7-pdo_odbc \ + php7-pdo_sqlite \ + db \ + php7-redis \ + php7-ftp \ + && rm -rf /var/cache/apk/ +COPY docker/setup_openrc.sh /usr/local/bin/ COPY tt-rss/* /app/public/tt-rss/ COPY docker/ttrss-openrc-apache /etc/init.d/apache COPY docker/ttrss-openrc-ttrssupdate /etc/init.d/ttrssupdate COPY docker/ttrss-openrc-ntpd /etc/init.d/ntpd - RUN mkdir -p /app/public/tt-rss/ /var/cache/tt-rss/images \ - /var/cache/tt-rss/upload /var/cache/tt-rss/export/ \ - /var/cache/tt-rss/js /var/lock/tt-rss/ && \ - chown -R apache:root /app/public /var/cache/tt-rss/ /var/lock/tt-rss/ && \ -# thanks https://github.com/neeravkumar/dockerfiles/blob/master/alpine-openrc/Dockerfile -# Tell openrc its running inside a container, till now that has meant LXC - sed -i 's/#rc_sys=""/rc_sys="lxc"/g' /etc/rc.conf &&\ -# Tell openrc loopback and net are already there, since docker handles the networking - echo 'rc_provide="loopback net"' >> /etc/rc.conf &&\ -# can't get ttys unless you run the container in privileged mode - sed -i '/tty/d' /etc/inittab &&\ -# can't set hostname since docker sets it - sed -i '/hostname $opts/d' /etc/init.d/hostname &&\ -# can't mount tmpfs since not privileged - sed -i '/mount -t tmpfs/d' /lib/rc/sh/init.sh &&\ -# can't do cgroups - sed -i '/cgroup_add_service$/d' /lib/rc/sh/openrc-run.sh &&\ - sed -i '/^ntpd/d' /bootstrap/start.sh &&\ - echo -e 'log_errors = On\nerror_log = syslog' >> /etc/php7/php.ini &&\ - sed -i -r 's@ErrorLog .*@ErrorLog "|/usr/bin/logger -n syslog -T -P 514 -t apacheErr"@i' /etc/apache2/httpd.conf &&\ - echo 'TransferLog "|/usr/bin/logger -n syslog -T -P 514 -t apacheLog"' >> /etc/apache2/httpd.conf &&\ - rc-update add ntpd && rc-update add apache && rc-update add ttrssupdate + /var/cache/tt-rss/upload /var/cache/tt-rss/export/ \ + /var/cache/tt-rss/js /var/lock/tt-rss/ \ + && chown -R apache:root \ + /app/public \ + /var/cache/tt-rss/ \ + /var/lock/tt-rss/ \ + && /usr/local/bin/setup_openrc.sh \ + && apk --no-cache add util-linux \ + && rc-update add ntpd \ + && rc-update add apache \ + && rc-update add ttrssupdate ENTRYPOINT [] diff --git a/docker/setup_openrc.sh b/docker/setup_openrc.sh new file mode 100755 index 0000000..7f0ac04 --- /dev/null +++ b/docker/setup_openrc.sh @@ -0,0 +1,22 @@ +#!/bin/sh + + +# thanks https://github.com/neeravkumar/dockerfiles/blob/master/alpine-openrc/Dockerfile +# Tell openrc its running inside a container, till now that has meant LXC +sed -i 's/#rc_sys=""/rc_sys="lxc"/g' /etc/rc.conf +# Tell openrc loopback and net are already there, since docker handles the networking +echo 'rc_provide="loopback net"' >> /etc/rc.conf +# can't get ttys unless you run the container in privileged mode +sed -i '/tty/d' /etc/inittab +# can't set hostname since docker sets it +sed -i '/hostname $opts/d' /etc/init.d/hostname +# can't mount tmpfs since not privileged +sed -i '/mount -t tmpfs/d' /lib/rc/sh/init.sh +# can't do cgroups +sed -i '/cgroup_add_service$/d' /lib/rc/sh/openrc-run.sh +sed -i '/^ntpd/d' /bootstrap/start.sh +echo -e 'log_errors = On\nerror_log = syslog' >> /etc/php7/php.ini +sed -i -r 's@ErrorLog .*@ErrorLog "|/usr/bin/logger -n syslog -T -P 514 -t apacheErr"@i' \ + /etc/apache2/httpd.conf +echo 'TransferLog "|/usr/bin/logger -n syslog -T -P 514 -t apacheLog"' \ + >> /etc/apache2/httpd.conf