From: Harald Hoyer Date: Wed, 12 May 2021 08:09:29 +0000 (+0200) Subject: ci: build container images and push to ghcr.io X-Git-Tag: 054~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c67644fe614db3a65e7bca49ebfa56707873441;p=thirdparty%2Fdracut.git ci: build container images and push to ghcr.io --- diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 000000000..2381b3e52 --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,54 @@ +name: Container +on: + schedule: + - cron: '30 11 * * *' # every day at 4:40 + push: + branches: [ master ] + paths: + - 'test/container/**' + - '.github/workflows/container.yml' + pull_request: + branches: [ master ] + paths: + - 'test/container/**' + - '.github/workflows/container.yml' + +permissions: + packages: write + contents: read + +jobs: + push_to_registry: + name: Build and push containers image to GitHub Packages + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }} + cancel-in-progress: true + strategy: + fail-fast: false + matrix: + config: + - { dockerfile: 'Dockerfile-Fedora-33', tag: 'fedora:33' } + - { dockerfile: 'Dockerfile-Fedora-34', tag: 'fedora:34' } + - { dockerfile: 'Dockerfile-Fedora-latest', tag: 'fedora:latest' } + - { dockerfile: 'Dockerfile-OpenSuse-latest', tag: 'opensuse:latest' } + - { dockerfile: 'Dockerfile-Arch', tag: 'arch:latest' } + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 +# with: +# buildkitd-flags: --debug + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and Push Container + uses: docker/build-push-action@v2 + with: + file: test/container/${{ matrix.config.dockerfile }} + tags: ghcr.io/dracutdevs/${{ matrix.config.tag }} + push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} diff --git a/test/container/Dockerfile-Arch b/test/container/Dockerfile-Arch new file mode 100644 index 000000000..9340e50f0 --- /dev/null +++ b/test/container/Dockerfile-Arch @@ -0,0 +1,25 @@ +FROM docker.io/archlinux + +MAINTAINER https://github.com/dracutdevs/dracut + +ENV container docker +LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE" + +RUN echo 'export DRACUT_NO_XATTR=1 KVERSION="$(rpm -qa kernel --qf "%{VERSION}-%{RELEASE}.%{ARCH}\n" | sort -rn | head -1)"' > /etc/profile.d/dracut-test.sh + +# Install needed packages for the dracut CI container +RUN pacman --noconfirm -Sy \ + linux dash strace gcc dhclient asciidoc make dracut \ + qemu jack btrfs-progs mdadm dmraid nfs-utils nfsidmap lvm2 nbd \ + dhcp networkmanager multipath-tools vi tcpdump open-iscsi \ + git shfmt shellcheck astyle which base-devel + +RUN useradd build && mkdir /build && chown -R build /build +RUN su build -c 'cd /build && git clone https://aur.archlinux.org/perl-config-general.git && cd perl-config-general && makepkg -s --noconfirm' +RUN pacman -U --noconfirm /build/perl-config-general/*.pkg.tar.* +RUN su build -c 'cd /build && git clone https://aur.archlinux.org/tgt.git && cd tgt && echo "CFLAGS=-Wno-error=stringop-truncation" >> PKGBUILD && makepkg -s --noconfirm' +RUN pacman -U --noconfirm /build/tgt/*.pkg.tar.* +RUN rm -fr /build + +# Set default command +CMD ["/usr/bin/bash"] diff --git a/test/container/Dockerfile-Fedora-33 b/test/container/Dockerfile-Fedora-33 new file mode 100644 index 000000000..37208d476 --- /dev/null +++ b/test/container/Dockerfile-Fedora-33 @@ -0,0 +1,53 @@ +FROM registry.fedoraproject.org/fedora:33 + +MAINTAINER https://github.com/dracutdevs/dracut + +ENV container docker +LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE" + +RUN echo 'export DRACUT_NO_XATTR=1 KVERSION="$(rpm -qa kernel --qf "%{VERSION}-%{RELEASE}.%{ARCH}\n" | sort -rn | head -1)"' > /etc/profile.d/dracut-test.sh + +# Install needed packages for the dracut CI container +RUN dnf -y install --setopt=install_weak_deps=False \ + dash \ + asciidoc \ + mdadm \ + lvm2 \ + dmraid \ + cryptsetup \ + nfs-utils \ + nbd \ + dhcp-server \ + scsi-target-utils \ + iscsi-initiator-utils \ + strace \ + btrfs-progs \ + kmod-devel \ + gcc \ + bzip2 \ + xz \ + tar \ + wget \ + rpm-build \ + make \ + git \ + bash-completion \ + sudo \ + kernel \ + dhcp-client \ + /usr/bin/qemu-kvm \ + /usr/bin/qemu-system-$(uname -i) \ + e2fsprogs \ + tcpdump \ + iproute \ + iputils \ + dbus-daemon \ + kbd \ + NetworkManager \ + python3-imgcreate \ + which \ + ShellCheck \ + && dnf -y update && dnf clean all + +# Set default command +CMD ["/usr/bin/bash"] diff --git a/test/container/Dockerfile-Fedora-34 b/test/container/Dockerfile-Fedora-34 new file mode 100644 index 000000000..72cdae728 --- /dev/null +++ b/test/container/Dockerfile-Fedora-34 @@ -0,0 +1,53 @@ +FROM registry.fedoraproject.org/fedora:34 + +MAINTAINER https://github.com/dracutdevs/dracut + +ENV container docker +LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE" + +RUN echo 'export DRACUT_NO_XATTR=1 KVERSION="$(rpm -qa kernel --qf "%{VERSION}-%{RELEASE}.%{ARCH}\n" | sort -rn | head -1)"' > /etc/profile.d/dracut-test.sh + +# Install needed packages for the dracut CI container +RUN dnf -y install --setopt=install_weak_deps=False \ + dash \ + asciidoc \ + mdadm \ + lvm2 \ + dmraid \ + cryptsetup \ + nfs-utils \ + nbd \ + dhcp-server \ + scsi-target-utils \ + iscsi-initiator-utils \ + strace \ + btrfs-progs \ + kmod-devel \ + gcc \ + bzip2 \ + xz \ + tar \ + wget \ + rpm-build \ + make \ + git \ + bash-completion \ + sudo \ + kernel \ + dhcp-client \ + /usr/bin/qemu-kvm \ + /usr/bin/qemu-system-$(uname -i) \ + e2fsprogs \ + tcpdump \ + iproute \ + iputils \ + dbus-daemon \ + kbd \ + NetworkManager \ + python3-imgcreate \ + which \ + ShellCheck \ + && dnf -y update && dnf clean all + +# Set default command +CMD ["/usr/bin/bash"] diff --git a/test/container/Dockerfile-Fedora-latest b/test/container/Dockerfile-Fedora-latest new file mode 100644 index 000000000..b6c1e2715 --- /dev/null +++ b/test/container/Dockerfile-Fedora-latest @@ -0,0 +1,53 @@ +FROM registry.fedoraproject.org/fedora:latest + +MAINTAINER https://github.com/dracutdevs/dracut + +ENV container docker +LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE" + +RUN echo 'export DRACUT_NO_XATTR=1 KVERSION="$(rpm -qa kernel --qf "%{VERSION}-%{RELEASE}.%{ARCH}\n" | sort -rn | head -1)"' > /etc/profile.d/dracut-test.sh + +# Install needed packages for the dracut CI container +RUN dnf -y install --setopt=install_weak_deps=False \ + dash \ + asciidoc \ + mdadm \ + lvm2 \ + dmraid \ + cryptsetup \ + nfs-utils \ + nbd \ + dhcp-server \ + scsi-target-utils \ + iscsi-initiator-utils \ + strace \ + btrfs-progs \ + kmod-devel \ + gcc \ + bzip2 \ + xz \ + tar \ + wget \ + rpm-build \ + make \ + git \ + bash-completion \ + sudo \ + kernel \ + dhcp-client \ + /usr/bin/qemu-kvm \ + /usr/bin/qemu-system-$(uname -i) \ + e2fsprogs \ + tcpdump \ + iproute \ + iputils \ + dbus-daemon \ + kbd \ + NetworkManager \ + python3-imgcreate \ + which \ + ShellCheck \ + && dnf -y update && dnf clean all + +# Set default command +CMD ["/usr/bin/bash"] diff --git a/test/container/Dockerfile-OpenSuse-latest b/test/container/Dockerfile-OpenSuse-latest new file mode 100644 index 000000000..377077a43 --- /dev/null +++ b/test/container/Dockerfile-OpenSuse-latest @@ -0,0 +1,23 @@ +FROM registry.opensuse.org/opensuse/tumbleweed-dnf:latest + +MAINTAINER https://github.com/dracutdevs/dracut + +ENV container docker +LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE" + +RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh + +# Install needed packages for the dracut CI container +RUN dnf -y install --setopt=install_weak_deps=False \ + dash asciidoc mdadm lvm2 dmraid cryptsetup nfs-utils nbd dhcp-server \ + strace libkmod-devel gcc bzip2 xz tar wget rpm-build make git bash-completion \ + sudo kernel dhcp-client qemu-kvm /usr/bin/qemu-system-$(uname -m) e2fsprogs \ + tcpdump iproute iputils kbd NetworkManager btrfsprogs tgt dbus-broker \ + iscsiuio open-iscsi which ShellCheck procps \ + && dnf -y update && dnf clean all + +RUN shfmt_version=3.2.4; wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt \ + && chmod +x /usr/local/bin/shfmt + +# Set default command +CMD ["/usr/bin/bash"]