Add .gitlab-ci.yml

This commit is contained in:
Jeffrey Serio 2024-03-06 03:28:16 -06:00
parent 88e9ae08cd
commit cd7b70fa6c
3 changed files with 63 additions and 6 deletions

46
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,46 @@
stages:
- build
fedora-build-job:
stage: build
tags:
- podman-exec
image: git.hyperreal.coffee:5050/fedora-atomic/containers/buildah:latest
variables:
STORAGE_DRIVER: vfs
BUILDAH_FORMAT: docker
BUILDAH_ISOLATION: chroot
FQ_IMAGE_NAME: "$CI_REGISTRY_IMAGE/fedora:latest"
before_script:
- buildah login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script:
- container=$(buildah from registry.fedoraproject.org/fedora:latest)
- buildah run $container -- sh -c 'printf "fastestmirror=True\ndeltarpm=True\n" | tee -a /etc/dnf/dnf.conf'
- buildah run $container -- dnf update -y
- buildah run $container -- dnf install -y '@container-management' '@development-tools' '@c-development' container-selinux ostree rpm-ostree rsync
- buildah run $container -- dnf clean all
- buildah commit --squash --rm $container "$FQ_IMAGE_NAME"
fedora-distrobox-build-job:
stage: build
tags:
- podman-exec
image: git.hyperreal.coffee:5050/fedora-atomic/containers/buildah:latest
variables:
STORAGE_DRIVER: vfs
BUILDAH_FORMAT: docker
BUILDAH_ISOLATION: chroot
FQ_IMAGE_NAME: "$CI_REGISTRY_NAME/fedora-distrobox:39"
before_script:
- buildah login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script:
- container=$(buildah from registry.fedoraproject.org/fedora-toolbox:39)
- buildah run $container -- sh -c 'printf "fastestmirror=True\ndeltarpm=True\n" | tee -a /etc/dnf/dnf.conf'
- buildah run $container -- dnf update -y
- buildah run $container -- dnf copr enable -y varlad/zellij
- buildah run $container -- dnf copr enable -y atim/starship
- buildah run $container -- sh -c 'printf "[charm]\nname=Charm\nbaseurl=https://repo.charm.sh/yum/\nenabled=1\ngpgcheck=1\ngpgkey=https://repo.charm.sh/yum/gpg.key\n" | tee /etc/yum.repos.d/charm.repo'
- buildah run $container -- dnf install -y '@c-development' '@development-tools' ShellCheck autossh bat btop charm cmake diff-so-fancy emacs fd-find fzf git git-core glow golang gum htop httpie hugo hyperfine jc jq just lsd lsof neofetch nodejs npm nu openssl-devel pass perl-Image-ExifTool pipx procs pv python3-devel python3-pip ranger ripgrep rsync shfmt starship tealdeer trash-cli vim-default-editor w3m wget xclip xsel zellij zsh --allowerasing
- buildah run $container -- dnf clean all
- buildah config --shell /usr/bin/nu $container
- buildah commit --squash --rm $container "$FQ_IMAGE_NAME"

View File

@ -1,6 +0,0 @@
FROM registry.fedoraproject.org/fedora:latest
RUN printf "fastestmirror=True\ndeltarpm=True\n" | tee -a /etc/dnf/dnf.conf \
&& dnf update -y \
&& dnf install -y '@container-management' '@development-tools' '@c-development' container-selinux ostree rpm-ostree rsync \
&& dnf clean all

17
buildah/Containerfile Normal file
View File

@ -0,0 +1,17 @@
FROM quay.io/buildah/stable:v1.34.0
RUN touch /etc/subgid /etc/subuid \
&& chmod g=u /etc/subgid /etc/subuid /etc/passwd \
&& echo build:10000:65536 > /etc/subuid \
&& echo build:10000:65536 > /etc/subgid
# Use chroot since the default runc doesn't work when running rootless
RUN echo "export BUILDAH_ISOLATION=chroot" >> /home/build/.bashrc
# Use VFS since fuse does not work
RUN mkdir -p /home/build/.config/containers \
&& (echo '[storage]';echo 'drive = "vfs"') > /home/build/.config/containers/storage.conf
# The buildah container will run as build user
USER build
WORKDIR /home/build