Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add multi arch docker build #5808

Merged
merged 36 commits into from Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
28eec20
Add multi arch container build
b-reich Nov 2, 2023
7bd3a15
using label from github action
b-reich Nov 3, 2023
e3e72b4
dont remove static labels and split docker readme in seperate action
b-reich Nov 3, 2023
1e2f4d4
pin 3rd party action to a commit
b-reich Nov 3, 2023
f29c107
enable pushing to dockerhub
b-reich Nov 3, 2023
51497c9
Update .github/workflows/build-images.yml
b-reich Nov 3, 2023
47e4520
remove not needed checkout
b-reich Nov 3, 2023
9bae9fe
set github token permissions
b-reich Nov 3, 2023
0e4a51d
Update .github/workflows/push-dockerhub-readme.yml
Alkarex Nov 3, 2023
0ef449d
update docker readme to match new tags
b-reich Nov 3, 2023
50f36c1
Apply suggestions from code review
Alkarex Nov 4, 2023
735be30
Merge branch 'edge' into edge
Alkarex Nov 4, 2023
3ea33af
fix suffix for alpine image
b-reich Nov 4, 2023
8255ac7
fix suffix for alpine image
b-reich Nov 4, 2023
97ff089
push images only at upstream repo
b-reich Nov 4, 2023
de09a2a
push images only at upstream repo
b-reich Nov 4, 2023
1bf588a
push images only at upstream repo
b-reich Nov 4, 2023
73f9417
tag latest-alpine as alpine
b-reich Nov 4, 2023
8a09f8e
tag latest-alpine as alpine
b-reich Nov 4, 2023
b65b047
remove no needed falvor
b-reich Nov 4, 2023
b5aede3
keep falvor for build
b-reich Nov 4, 2023
4de930b
Clean more things
Alkarex Nov 5, 2023
0b041d0
Rename action
Alkarex Nov 5, 2023
fdc0807
Rename readme action
Alkarex Nov 5, 2023
d583cf8
Use default name for dockerhub-description
Alkarex Nov 5, 2023
239b8e7
Experiment with build-args
Alkarex Nov 5, 2023
6929640
Debug
Alkarex Nov 5, 2023
34411c9
Add checkout back
Alkarex Nov 5, 2023
f5155d7
Revert back to metadata-action
Alkarex Nov 5, 2023
78c57ed
Remove quotes in version
Alkarex Nov 5, 2023
052d1ac
Try to fix variables
Alkarex Nov 5, 2023
bdeb0a0
Experiment with automatic label values again
Alkarex Nov 5, 2023
5da2c90
Delete last Docker Hub hooks
Alkarex Nov 5, 2023
3d110b8
Use only git SHA for org.opencontainers.image.revision
Alkarex Nov 5, 2023
97af192
Comment out semver for now
Alkarex Nov 5, 2023
fd69343
Enable major semver
Alkarex Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/build-images.yml
@@ -0,0 +1,91 @@
name: build-images

on:
push:
branches:
- edge
b-reich marked this conversation as resolved.
Show resolved Hide resolved
release:
workflow_dispatch:
b-reich marked this conversation as resolved.
Show resolved Hide resolved

b-reich marked this conversation as resolved.
Show resolved Hide resolved
jobs:
build-docker-image:
name: Image Build ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: Debian
file: Docker/Dockerfile
flavor: |
latest=auto
suffix=
onlatest=false
- name: Alpine
file: Docker/Dockerfile-Alpine
flavor: |
latest=auto
suffix=-alpine
onlatest=true
steps:
- name: Checkout
uses: actions/checkout@v4
b-reich marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# - name: Login to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
b-reich marked this conversation as resolved.
Show resolved Hide resolved

# - name: Login to GitHub Container Registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any comments about how pros and cons of (also) using the GitHub Container Registry?
Probably seems overkill for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For podman user?
And Dockerhub had in the pass some weird decisions I think.

Personaly I prefer the github registry

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Let's keep it but comment out for now, so we can easily activate if needed.
I am not familiar with the use-case: Can't Podman users pull from Docker Hub?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can, but the default registry (dockerhub) is not set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newer podman versions try dockerhub on unspecified image tags. Personally I don't think it matters much as its the same image

# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: ${{ matrix.flavor }}
images: |
docker.io/freshrss/freshrss
ghcr.io/${{ github.repository }}
tags: |
type=edge
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
labels: |
org.opencontainers.image.description="A self-hosted RSS feed aggregator"
org.opencontainers.image.documentation="https://freshrss.github.io/FreshRSS/"
org.opencontainers.image.url="https://freshrss.org/"
Alkarex marked this conversation as resolved.
Show resolved Hide resolved


- name: Build and push
uses: docker/build-push-action@v5
with:
file: ${{ matrix.file }}
platforms: linux/arm/v7,linux/arm64,linux/amd64
push: ${{ github.ref == 'refs/heads/latest' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

push-docker-readme:
b-reich marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Update repo description
uses: peter-evans/dockerhub-description@v3
b-reich marked this conversation as resolved.
Show resolved Hide resolved
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: freshrss/freshrss
readme-filepath: Docker/README.md
12 changes: 0 additions & 12 deletions Docker/Dockerfile
Expand Up @@ -23,18 +23,6 @@ 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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep the static ones here, so that they exist when the builds are done locally, e.g. like

build:
# Pick #latest (stable release) or #edge (rolling release) or a specific release like #1.21.0
context: https://github.com/FreshRSS/FreshRSS.git#latest
dockerfile: Docker/Dockerfile-Alpine

authors can be removed

By the way, if anyone knows a way to populate revision and/or version even in those more manual scenarios, let me know

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what happen when you use the github action ones and the static ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to remove the static ones from GitHub Actions, so that we can see whether that is sufficient or whether they need to be overridden again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some docu about.
passing labels at build time will overwrite the static ones


RUN a2dismod -q -f alias autoindex negotiation status && \
a2dismod -q auth_openidc && \
a2enmod -q deflate expires headers mime remoteip setenvif && \
Expand Down
16 changes: 0 additions & 16 deletions Docker/Dockerfile-Alpine
Expand Up @@ -16,22 +16,6 @@ WORKDIR /var/www/FreshRSS
COPY . /var/www/FreshRSS
COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/

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 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/^/#/" \
Expand Down