A free, self-hostable news aggregator…
add multi arch docker build (#5808)
Benjamin Reich8f07199777a2
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.ymlnew file mode 100644index 000000000..3d2b1ea46--- /dev/null+++ b/.github/workflows/docker-publish.yml@@ -0,0 +1,92 @@+name: Publish Docker images++on:+ push:+ branches:+ - edge+ release:+ workflow_dispatch:++permissions:+ contents: read+ # packages: write++jobs:+ build-container-image:+ name: Build Docker image ${{ matrix.name }}+ runs-on: ubuntu-latest+ strategy:+ matrix:+ include:+ - name: Debian+ file: Docker/Dockerfile+ flavor: |+ latest=auto+ tags: |+ type=edge,onlatest=false+ type=semver,pattern={{version}}+ type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}+ # type=semver,pattern={{major}}.{{minor}}+ - name: Alpine+ file: Docker/Dockerfile-Alpine+ flavor: |+ latest=false+ tags: |+ type=raw,value=alpine,enable=${{ github.ref == 'refs/heads/latest' || startsWith(github.ref, 'refs/tags/') }}+ type=edge,suffix=-alpine,onlatest=false+ type=semver,pattern={{version}}-alpine+ type=semver,pattern={{major}}-alpine,enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}+ # type=semver,pattern={{major}}.{{minor}}-alpine+ steps:+ - name: Set up QEMU+ uses: docker/setup-qemu-action@v3++ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v3++ - name: Checkout+ uses: actions/checkout@v4++ - name: Get FreshRSS version+ run: |+ FRESHRSS_VERSION=$(sed -n "s/^const FRESHRSS_VERSION = '\(.*\)'.*$/\1/p" constants.php)+ echo "$FRESHRSS_VERSION"+ echo "FRESHRSS_VERSION=$FRESHRSS_VERSION" >> $GITHUB_ENV++ - name: Add metadata to Docker images+ id: meta+ uses: docker/metadata-action@v5+ with:+ flavor: ${{ matrix.flavor }}+ images: |+ docker.io/freshrss/freshrss+ # ghcr.io/${{ github.repository }}+ tags: ${{ matrix.tags }}+ labels: |+ org.opencontainers.image.version=${{ env.FRESHRSS_VERSION }}++ - name: Login to Docker Hub+ if: github.repository_owner == 'FreshRSS'+ uses: docker/login-action@v3+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ # - name: Login to GitHub Container Registry+ # uses: docker/login-action@v3+ # with:+ # registry: ghcr.io+ # username: ${{ github.repository_owner }}+ # password: ${{ secrets.GITHUB_TOKEN }}++ - name: Build and push Docker images+ uses: docker/build-push-action@v5+ with:+ file: ${{ matrix.file }}+ platforms: linux/amd64,linux/arm/v7,linux/arm64+ build-args: |+ FRESHRSS_VERSION=${{ env.FRESHRSS_VERSION }}+ SOURCE_COMMIT=${{ github.sha }}+ tags: ${{ steps.meta.outputs.tags }}+ labels: ${{ steps.meta.outputs.labels }}+ push: ${{ (github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/edge' || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'FreshRSS' }}diff --git a/.github/workflows/dockerhub-description.yml b/.github/workflows/dockerhub-description.ymlnew file mode 100644index 000000000..34f3addeb--- /dev/null+++ b/.github/workflows/dockerhub-description.yml@@ -0,0 +1,24 @@+name: Update Docker Hub description++on:+ push:+ paths:+ - Docker/README.md+ branches:+ - edge+ workflow_dispatch:++jobs:+ dockerhub-description:+ if: github.repository_owner == 'FreshRSS'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4++ - name: Update repo description+ uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_PASSWORD }}+ repository: freshrss/freshrss+ readme-filepath: Docker/README.mddiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1526cef75..2916e7ce4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,8 @@* Bug fixing* Fix regression in Docker `CRON_MIN` if any environment variable contains a single quote [#5795](https://github.com/FreshRSS/FreshRSS/pull/5795)* Fix JavaScript regression in label dropdown [#5785](https://github.com/FreshRSS/FreshRSS/pull/5785)+* Deployment+ * Use GitHub Actions to build Docker images, offering architectures `amd64`, `arm32v7`, `arm64v8` with automatic detection [#5808](https://github.com/FreshRSS/FreshRSS/pull/5808)* Misc.* Code improvements [#5511](https://github.com/FreshRSS/FreshRSS/pull/5511)* Update dev dependencies [#5787](https://github.com/FreshRSS/FreshRSS/pull/5787),diff --git a/Docker/Dockerfile b/Docker/Dockerfileindex 239a0e067..0379be6c6 100644--- a/Docker/Dockerfile+++ b/Docker/Dockerfile@@ -20,7 +20,6 @@ COPY . /var/www/FreshRSSCOPY ./Docker/*.Apache.conf /etc/apache2/sites-available/ARG FRESHRSS_VERSION-ARG SOURCE_BRANCHARG SOURCE_COMMITLABEL \@@ -28,7 +27,7 @@ LABEL \org.opencontainers.image.description="A self-hosted RSS feed aggregator" \org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/" \org.opencontainers.image.licenses="AGPL-3.0" \- org.opencontainers.image.revision="${SOURCE_BRANCH}.${SOURCE_COMMIT}" \+ org.opencontainers.image.revision="${SOURCE_COMMIT}" \org.opencontainers.image.source="https://github.com/FreshRSS/FreshRSS" \org.opencontainers.image.title="FreshRSS" \org.opencontainers.image.url="https://freshrss.org/" \diff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpineindex 1da380f81..29dadda0d 100644--- a/Docker/Dockerfile-Alpine+++ b/Docker/Dockerfile-Alpine@@ -17,7 +17,6 @@ COPY . /var/www/FreshRSSCOPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ARG FRESHRSS_VERSION-ARG SOURCE_BRANCHARG SOURCE_COMMITLABEL \@@ -25,7 +24,7 @@ LABEL \org.opencontainers.image.description="A self-hosted RSS feed aggregator" \org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/" \org.opencontainers.image.licenses="AGPL-3.0" \- org.opencontainers.image.revision="${SOURCE_BRANCH}.${SOURCE_COMMIT}" \+ org.opencontainers.image.revision="${SOURCE_COMMIT}" \org.opencontainers.image.source="https://github.com/FreshRSS/FreshRSS" \org.opencontainers.image.title="FreshRSS" \org.opencontainers.image.url="https://freshrss.org/" \diff --git a/Docker/Dockerfile-Newest b/Docker/Dockerfile-Newestindex 159f244f6..68a23e553 100644--- a/Docker/Dockerfile-Newest+++ b/Docker/Dockerfile-Newest@@ -18,7 +18,6 @@ COPY . /var/www/FreshRSSCOPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ARG FRESHRSS_VERSION-ARG SOURCE_BRANCHARG SOURCE_COMMITLABEL \@@ -26,7 +25,7 @@ LABEL \org.opencontainers.image.description="A self-hosted RSS feed aggregator" \org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/" \org.opencontainers.image.licenses="AGPL-3.0" \- org.opencontainers.image.revision="${SOURCE_BRANCH}.${SOURCE_COMMIT}" \+ org.opencontainers.image.revision="${SOURCE_COMMIT}" \org.opencontainers.image.source="https://github.com/FreshRSS/FreshRSS" \org.opencontainers.image.title="FreshRSS" \org.opencontainers.image.url="https://freshrss.org/" \diff --git a/Docker/Dockerfile-Oldest b/Docker/Dockerfile-Oldestindex b2d915571..2ed2e1a38 100644--- a/Docker/Dockerfile-Oldest+++ b/Docker/Dockerfile-Oldest@@ -17,7 +17,6 @@ COPY . /var/www/FreshRSSCOPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ARG FRESHRSS_VERSION-ARG SOURCE_BRANCHARG SOURCE_COMMITLABEL \@@ -25,7 +24,7 @@ LABEL \org.opencontainers.image.description="A self-hosted RSS feed aggregator" \org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/" \org.opencontainers.image.licenses="AGPL-3.0" \- org.opencontainers.image.revision="${SOURCE_BRANCH}.${SOURCE_COMMIT}" \+ org.opencontainers.image.revision="${SOURCE_COMMIT}" \org.opencontainers.image.source="https://github.com/FreshRSS/FreshRSS" \org.opencontainers.image.title="FreshRSS" \org.opencontainers.image.url="https://freshrss.org/" \diff --git a/Docker/Dockerfile-QEMU-ARM b/Docker/Dockerfile-QEMU-ARMdeleted file mode 100644index 48ce56345..000000000--- a/Docker/Dockerfile-QEMU-ARM+++ /dev/null@@ -1,81 +0,0 @@-# 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/debian:12-slim--# Requires ./hooks/*-COPY ./Docker/qemu-arm-* /usr/bin/--ENV TZ UTC-SHELL ["/bin/bash", "-o", "pipefail", "-c"]--ARG DEBIAN_FRONTEND=noninteractive-RUN apt-get update && \- apt-get install --no-install-recommends -y \- ca-certificates cron \- apache2 libapache2-mod-php \- libapache2-mod-auth-openidc \- php-curl php-gmp 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/--ARG FRESHRSS_VERSION-ARG SOURCE_BRANCH-ARG SOURCE_COMMIT--LABEL \- org.opencontainers.image.authors="Alkarex" \- org.opencontainers.image.description="A self-hosted RSS feed aggregator" \- org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/" \- org.opencontainers.image.licenses="AGPL-3.0" \- org.opencontainers.image.revision="${SOURCE_BRANCH}.${SOURCE_COMMIT}" \- org.opencontainers.image.source="https://github.com/FreshRSS/FreshRSS" \- org.opencontainers.image.title="FreshRSS" \- org.opencontainers.image.url="https://freshrss.org/" \- org.opencontainers.image.vendor="FreshRSS" \- org.opencontainers.image.version="$FRESHRSS_VERSION"--RUN a2dismod -q -f alias autoindex negotiation status && \- a2dismod -q auth_openidc && \- a2enmod -q deflate expires headers mime remoteip setenvif && \- a2disconf -q '*' && \- a2dissite -q '*' && \- a2ensite -q 'FreshRSS*'--RUN sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" /etc/apache2/apache2.conf && \- sed -r -i "/^\s*Listen /s/^/#/" /etc/apache2/ports.conf && \- # Disable built-in updates when using Docker, as the full image is supposed to be updated instead.- sed -r -i "\\#disable_update#s#^.*#\t'disable_update' => true,#" ./config.default.php && \- 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" > /etc/crontab.freshrss.default--# Seems needed for arm32v7/ubuntu on Docker Hub-RUN update-ca-certificates -f--# Useful with the `--squash` build option-RUN rm /usr/bin/qemu-* /var/www/FreshRSS/Docker/qemu-*--ENV COPY_LOG_TO_SYSLOG On-ENV COPY_SYSLOG_TO_STDERR On-ENV CRON_MIN ''-ENV DATA_PATH ''-ENV FRESHRSS_ENV ''-ENV LISTEN ''-ENV OIDC_ENABLED ''-ENV TRUSTED_PROXY ''--ENTRYPOINT ["./Docker/entrypoint.sh"]--EXPOSE 80-# hadolint ignore=DL3025-CMD ([ -z "$CRON_MIN" ] || cron) && \- . /etc/apache2/envvars && \- exec apache2 -D FOREGROUND $([ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ] && echo '-D OIDC_ENABLED')diff --git a/Docker/README.md b/Docker/README.mdindex 01d2e59a6..39885b0e3 100644--- a/Docker/README.md+++ b/Docker/README.md@@ -66,13 +66,16 @@ The [tags](https://hub.docker.com/r/freshrss/freshrss/tags) correspond to FreshR* `:latest` (default) is the [latest stable release](https://github.com/FreshRSS/FreshRSS/releases/latest)* `:edge` is the rolling release, same than our [git `edge` branch](https://github.com/FreshRSS/FreshRSS/tree/edge)-* `:x.y.z` are [specific FreshRSS releases](https://github.com/FreshRSS/FreshRSS/releases)-* `:arm` or `:*-arm` are the ARM `arm32v7` versions (e.g., for Raspberry Pi).+* `:x.y.z` tags correspond to [specific FreshRSS releases](https://github.com/FreshRSS/FreshRSS/releases), allowing you to target a precise version for deployment+* `:x.y` tags are tied to a specific major version and minor version number. For example, `:1.23` will automatically receive updates for any `1.23.x` releases, but will not update to `1.24.x`+* `:x` tags track the latest release within a major version series. For instance, `:1` will update to include any `1.x` releases, but will exclude versions beyond `2.x`+* `*-alpine` use Linux Alpine as base-image instead of Debian+* Our Docker images are designed with multi-architecture support, accommodating a variety of Linux platforms including `linux/arm/v7`, `linux/arm64`, and `linux/amd64`.* For other platforms, see the [custom build section](#build-custom-docker-image)### Linux: Debian vs. Alpine-Our default image is based on [Debian](https://www.debian.org/). We offer an alternative based on [Alpine](https://alpinelinux.org/) (with the `:alpine` or `*-alpine` tag suffix).+Our default image is based on [Debian](https://www.debian.org/). 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) (2019), Alpine was slower,while Alpine is smaller on disk (and much faster to build),and with newer packages in general (Apache, PHP).@@ -108,7 +111,7 @@ docker rm freshrss_old## Build custom Docker imageBuilding your own Docker image is especially relevant for platforms not available on our Docker Hub,-which is currently limited to `x64` (Intel, AMD) and `arm32v7`.+which is currently limited to `x64` (Intel, AMD), `arm32v7`, `arm64`.> ℹ️ If you try to run an image for the wrong platform, you might get an error message like *exec format error*.@@ -395,27 +398,6 @@ docker-compose down --remove-orphans --volumes> ℹ️ You can combine it with `-f docker-compose-db.yml` to spin a PostgreSQL database.-### Docker Compose and ARM64--If you’re working or want to host on an ARM64 system (such as Apple Silicon (M1/M2)) you’ll need to use the `arm` tag in your `docker-compose.yml` file:-```yaml-image: freshrss/freshrss:arm-```--If you then get this error message when running `docker compose up`:--> The requested image’s platform (linux/arm/v7) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested--… you will also need to specify the platform in the `service` part:--```yaml-services:- freshrss:- image: freshrss/freshrss:arm- platform: linux/arm/v7- container_name: freshrss- ```-## Run in productionFor production, it is a good idea to use a reverse proxy on your host server, providing HTTPS.diff --git a/Docker/hooks/build b/Docker/hooks/builddeleted file mode 100755index 427151e6f..000000000--- a/Docker/hooks/build+++ /dev/null@@ -1,21 +0,0 @@-#!/bin/bash--cd ..-FRESHRSS_VERSION=$(grep "'FRESHRSS_VERSION'" constants.php | cut -d "'" -f4)-echo "$FRESHRSS_VERSION"--if [[ $DOCKERFILE_PATH == *-ARM ]]; then- #TODO: Add --squash --platform arm options when Docker Hub daemon supports them- docker build \- --build-arg FRESHRSS_VERSION="$FRESHRSS_VERSION" \- --build-arg SOURCE_BRANCH="$SOURCE_BRANCH" \- --build-arg SOURCE_COMMIT="$SOURCE_COMMIT" \- -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .-else- #TODO: Add --squash option when Docker Hub daemon supports it- docker build \- --build-arg FRESHRSS_VERSION="$FRESHRSS_VERSION" \- --build-arg SOURCE_BRANCH="$SOURCE_BRANCH" \- --build-arg SOURCE_COMMIT="$SOURCE_COMMIT" \- -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .-fidiff --git a/Docker/hooks/post_checkout b/Docker/hooks/post_checkoutdeleted file mode 100644index b33c941e5..000000000--- a/Docker/hooks/post_checkout+++ /dev/null@@ -1,4 +0,0 @@-#!/bin/bash--mv ../README.md ../README.en.md-mv README.md ../diff --git a/Docker/hooks/pre_build b/Docker/hooks/pre_builddeleted file mode 100755index b2cda0e48..000000000--- a/Docker/hooks/pre_build+++ /dev/null@@ -1,11 +0,0 @@-#!/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-fidiff --git a/Makefile b/Makefileindex ec96c2f3c..1759c7d7c 100644--- a/Makefile+++ b/Makefile@@ -21,8 +21,6 @@ endififeq ($(findstring alpine,$(TAG)),alpine)DOCKERFILE=Dockerfile-Alpine-else ifeq ($(findstring arm,$(TAG)),arm)- DOCKERFILE=Dockerfile-QEMU-ARMelseDOCKERFILE=Dockerfileendifdiff --git a/docs/en/developers/02_First_steps.md b/docs/en/developers/02_First_steps.mdindex bc6361167..87c64ee2f 100644--- a/docs/en/developers/02_First_steps.md+++ b/docs/en/developers/02_First_steps.md@@ -40,7 +40,7 @@ If you’re interested in the configuration, the `make` commands are defined inIf you need to use a different tag image (default is `alpine`), you can set the `TAG` environment variable:```sh-TAG=arm make start+TAG=alpine make start```You can find the full list of available tags [on the Docker hub](https://hub.docker.com/r/freshrss/freshrss/tags).@@ -49,11 +49,9 @@ If you want to build the Docker image yourself, you can use the following comman```shmake build-# or-TAG=arm make build```-The `TAG` variable can be anything (e.g. `local`). You can target a specific architecture by adding `-alpine` or `-arm` at the end of the tag (e.g. `local-arm`).+The `TAG` variable can be anything (e.g. `local`). You can target a specific architecture by adding `-alpine` at the end of the tag (e.g. `local-alpine`).## Project architecturediff --git a/docs/fr/developers/01_First_steps.md b/docs/fr/developers/01_First_steps.mdindex f53cbaeb8..08f9436ff 100644--- a/docs/fr/developers/01_First_steps.md+++ b/docs/fr/developers/01_First_steps.md@@ -66,7 +66,7 @@ suivante la variable d’environnement `TAG` au moment de l’exécution de lacommande :```sh-TAG=arm make start+TAG=alpine make start```Vous pouvez trouver la liste complète des tags disponibles [sur le hub@@ -77,13 +77,11 @@ suivante :```shmake build-# ou-TAG=arm make build```La valeur de la variable `TAG` peut contenir n’importe quelle valeur (parexemple `local`). Vous pouvez cibler une architecture spécifique en ajoutant-`-alpine` ou `-arm` à la fin du tag (par exemple `local-arm`).+`-alpine` à la fin du tag (par exemple `local-alpine`).## Architecture du projet