ci: build container images and push to ghcr.io

master
Harald Hoyer 2021-05-12 10:09:29 +02:00 committed by Harald Hoyer
parent 5c94cf41e8
commit 3c67644fe6
6 changed files with 261 additions and 0 deletions

54
.github/workflows/container.yml vendored Normal file
View File

@ -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' }}

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]