A free, self-hostable news aggregator…
Docker build for ARM (Raspberry Pi) (#2436)
Alexandre Alapetitedcb090dcd779
diff --git a/Docker/Dockerfile-QEMU-ARM b/Docker/Dockerfile-QEMU-ARMnew file mode 100644index 000000000..889be2cb8--- /dev/null+++ b/Docker/Dockerfile-QEMU-ARM@@ -0,0 +1,46 @@+# Only relevant for Docker Hub or QEMU multi-architecture builds.+# Prefer the normal `Dockerfile` if you are building manually on the targeted architecture.++FROM arm32v7/ubuntu:19.04++# Requires ./hooks/*+COPY ./Docker/qemu-* /usr/bin/++ENV TZ UTC+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone++RUN apt update && \+ apt install --no-install-recommends -y \+ ca-certificates 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/+WORKDIR /var/www/FreshRSS++COPY . /var/www/FreshRSS+COPY ./Docker/*.Apache.conf /etc/apache2/sites-available/++RUN a2dismod -f alias autoindex negotiation status && \+ a2enmod deflate expires headers mime 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 && \+ touch /var/www/FreshRSS/Docker/env.txt && \+ echo "17,47 * * * * . /var/www/FreshRSS/Docker/env.txt; \+ su www-data -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' \+ 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" | crontab -++ENV COPY_SYSLOG_TO_STDERR On+ENV CRON_MIN ''+ENTRYPOINT ["./Docker/entrypoint.sh"]++EXPOSE 80+CMD ([ -z "$CRON_MIN" ] || cron) && \+ . /etc/apache2/envvars && \+ exec apache2 -D FOREGROUNDdiff --git a/Docker/README.md b/Docker/README.mdindex cdb6a0a4e..c2db38fb5 100644--- a/Docker/README.md+++ b/Docker/README.md@@ -37,6 +37,7 @@ sudo docker run -d --restart unless-stopped --log-opt max-size=10m \-p 80:80 \-p 443:443 \--name traefik traefik --docker \+ --loglevel=info \--entryPoints='Name:http Address::80 Compress:true Redirect.EntryPoint:https' \--entryPoints='Name:https Address::443 Compress:true TLS TLS.MinVersion:VersionTLS12 TLS.SniStrict:true TLS.CipherSuites:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA' \--defaultentrypoints=http,https --keeptrailingslash=true \@@ -51,7 +52,7 @@ See [more information about Docker and Let’s Encrypt in Træfik](https://docs.Example using the built-in refresh cron job (see further below for alternatives).You must first chose a domain (DNS) or sub-domain, e.g. `freshrss.example.net`.-> **N.B.:** For platforms other than x64 (Intel, AMD), such as ARM (e.g. Raspberry Pi), see the section *Build Docker image* further below.+> **N.B.:** Default images are for x64 (Intel, AMD) platforms. For ARM (e.g. Raspberry Pi), use the `*-arm` tags. For other platforms, see the section *Build Docker image* further below.```shsudo docker volume create freshrss-data@@ -137,7 +138,7 @@ The tags correspond to FreshRSS branches and versions:* `:x.y.z` are specific FreshRSS releases### Linux: Ubuntu vs. Alpine-Our default image is based on [Ubuntu](https://www.ubuntu.com/server). We offer an alternative based on [Alpine](https://alpinelinux.org/) (with the `-alpine` tag suffix).+Our default image is based on [Ubuntu](https://www.ubuntu.com/server). We offer an alternative based on [Alpine](https://alpinelinux.org/) (with the `*-alpine` tag suffix).In [our tests](https://github.com/FreshRSS/FreshRSS/pull/2205), Ubuntu is ~3 times faster,while Alpine is ~2.5 times [smaller on disk](https://hub.docker.com/r/freshrss/freshrss/tags) (and much faster to build).diff --git a/Docker/hooks/pre_build b/Docker/hooks/pre_buildnew file mode 100755index 000000000..f6c8211c0--- /dev/null+++ b/Docker/hooks/pre_build@@ -0,0 +1,12 @@+#!/bin/bash++if [[ "$DOCKERFILE_PATH" == *-ARM ]];+then+ # https://github.com/balena-io/qemu+ # Download a local copy of QEMU on Docker Hub build machine+ curl -LSs 'https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz' | tar -xzv --strip-components=1 --wildcards '*/qemu-*'++ # https://github.com/multiarch/qemu-user-static+ # Register qemu-*-static for all supported processors except the current one, but also remove all registered binfmt_misc before+ docker run --rm --privileged multiarch/qemu-user-static:register --reset+fi