aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-03-02 21:49:20 +0100
committerGravatar GitHub <noreply@github.com> 2019-03-02 21:49:20 +0100
commitfc8fb0a7ee0d98f8c31be3bd6e76719ebb0e68ee (patch)
treeb76e72a4463873280b2b64579408e95c1ac51c61
parentb869c2944a01c5060d05a093d5e0c797d48bb159 (diff)
Docker image alternative using Ubuntu (#2205)
* Docker image alternative using Ubuntu Ubuntu seems to be faster, cf. e.g. PHPBench. It is quite usual for Docker images to offer both a Debian/Ubuntu and an Alpine version, so we could also do the same if there is any need. Follow-up of https://github.com/FreshRSS/FreshRSS/pull/2202 * Only explicit use of Apache confs Fix double-logging issue * Explicit ServerTokens OS Default Apache configuration in Ubuntu, which was removed when disabling all confs. It is also the default Apache configuration in Alpine. * Take advantage of syslog for actualization Same than for Alpine https://github.com/FreshRSS/FreshRSS/pull/2208/commits/43ab629e27799cb28ec28ad409a512e128d11e97 * COPY_SYSLOG_TO_STDERR Same as https://github.com/FreshRSS/FreshRSS/pull/2213 * Update to libapache2-mod-php instead of php-fpm * Default to Ubuntu Ubuntu mod-php wins, being ~14% faster than Ubuntu php-fpm (which was ~300% faster than Alpine mod-php)
-rw-r--r--Docker/Dockerfile44
-rw-r--r--Docker/Dockerfile-Alpine34
-rw-r--r--Docker/FreshRSS.Apache.conf1
3 files changed, 59 insertions, 20 deletions
diff --git a/Docker/Dockerfile b/Docker/Dockerfile
index cd0f521a0..53feb31d4 100644
--- a/Docker/Dockerfile
+++ b/Docker/Dockerfile
@@ -1,28 +1,31 @@
-FROM alpine:3.9
+FROM ubuntu:18.10
ENV TZ UTC
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
-RUN apk add --no-cache \
- apache2 php7-apache2 \
- php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \
- php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-session php7-simplexml php7-xmlreader php7-zlib \
- php7-pdo_sqlite php7-pdo_mysql php7-pdo_pgsql
+RUN apt update && \
+ apt install --no-install-recommends -y \
+ cron \
+ apache2 libapache2-mod-php \
+ php-curl php-intl php-mbstring php-xml php-zip \
+ php-sqlite3 php-mysql php-pgsql && \
+ rm -rf /var/lib/apt/lists/
-RUN mkdir -p /var/www/FreshRSS /run/apache2/
+RUN mkdir -p /var/www/FreshRSS /run/apache2/ /run/php/
WORKDIR /var/www/FreshRSS
COPY . /var/www/FreshRSS
-COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/
-
-RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \
- /etc/apache2/conf.d/status.conf /etc/apache2/conf.d/userdir.conf && \
- sed -r -i "/^\s*LoadModule .*mod_(alias|autoindex|negotiation|status).so$/s/^/#/" \
- /etc/apache2/httpd.conf && \
- sed -r -i "/^\s*#\s*LoadModule .*mod_(deflate|expires|headers|mime|setenvif).so$/s/^\s*#//" \
- /etc/apache2/httpd.conf && \
- sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" \
- /etc/apache2/httpd.conf && \
- echo "17,37 * * * * su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \
+COPY ./Docker/*.Apache.conf /etc/apache2/sites-available/
+
+RUN a2dismod -f alias autoindex negotiation status && \
+ a2enmod deflate expires headers mime proxy_fcgi setenvif && \
+ a2disconf '*' && \
+ a2dissite '*' && \
+ a2ensite 'FreshRSS*'
+
+RUN sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" /etc/apache2/apache2.conf && \
+ sed -r -i "/^\s*Listen /s/^/#/" /etc/apache2/ports.conf && \
+ echo "17,37 su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \
/var/spool/cron/crontabs/root
ENV COPY_SYSLOG_TO_STDERR On
@@ -30,5 +33,6 @@ ENV CRON_MIN ''
ENTRYPOINT ["./Docker/entrypoint.sh"]
EXPOSE 80
-CMD ([ -z "$CRON_MIN" ] || crond -d 6) && \
- exec httpd -D FOREGROUND
+CMD ([ -z "$CRON_MIN" ] || cron) && \
+ . /etc/apache2/envvars && \
+ exec apache2 -D FOREGROUND
diff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpine
new file mode 100644
index 000000000..cd0f521a0
--- /dev/null
+++ b/Docker/Dockerfile-Alpine
@@ -0,0 +1,34 @@
+FROM alpine:3.9
+
+ENV TZ UTC
+
+RUN apk add --no-cache \
+ apache2 php7-apache2 \
+ php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \
+ php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-session php7-simplexml php7-xmlreader php7-zlib \
+ php7-pdo_sqlite php7-pdo_mysql php7-pdo_pgsql
+
+RUN mkdir -p /var/www/FreshRSS /run/apache2/
+WORKDIR /var/www/FreshRSS
+
+COPY . /var/www/FreshRSS
+COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/
+
+RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \
+ /etc/apache2/conf.d/status.conf /etc/apache2/conf.d/userdir.conf && \
+ sed -r -i "/^\s*LoadModule .*mod_(alias|autoindex|negotiation|status).so$/s/^/#/" \
+ /etc/apache2/httpd.conf && \
+ sed -r -i "/^\s*#\s*LoadModule .*mod_(deflate|expires|headers|mime|setenvif).so$/s/^\s*#//" \
+ /etc/apache2/httpd.conf && \
+ sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" \
+ /etc/apache2/httpd.conf && \
+ echo "17,37 * * * * su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \
+ /var/spool/cron/crontabs/root
+
+ENV COPY_SYSLOG_TO_STDERR On
+ENV CRON_MIN ''
+ENTRYPOINT ["./Docker/entrypoint.sh"]
+
+EXPOSE 80
+CMD ([ -z "$CRON_MIN" ] || crond -d 6) && \
+ exec httpd -D FOREGROUND
diff --git a/Docker/FreshRSS.Apache.conf b/Docker/FreshRSS.Apache.conf
index 80f6389d8..6621ff16f 100644
--- a/Docker/FreshRSS.Apache.conf
+++ b/Docker/FreshRSS.Apache.conf
@@ -4,6 +4,7 @@ DocumentRoot /var/www/FreshRSS/p/
CustomLog /dev/stdout combined
ErrorLog /dev/stderr
AllowEncodedSlashes On
+ServerTokens OS
<Directory />
AllowOverride None