From f081724b3976047ce6858981d372beca6a40c01a Mon Sep 17 00:00:00 2001 From: James Reilly Date: Apr 28 2025 09:27:36 +0000 Subject: Add Containerfile for CentOS Stream 10 --- diff --git a/Containerfile.c10s b/Containerfile.c10s new file mode 100644 index 0000000..126231b --- /dev/null +++ b/Containerfile.c10s @@ -0,0 +1,62 @@ +FROM quay.io/centoshyperscale/centos:stream10 + +# Based on https://developers.redhat.com/blog/2019/08/14/best-practices-for-running-buildah-in-a-container +# https://github.com/containers/buildah/blob/main/docs/tutorials/05-openshift-rootless-build.md +# https://github.com/containers/buildah/blob/main/contrib/buildahimage/stable/Containerfile + +ENV _BUILDAH_STARTED_IN_USERNS="" +ENV BUILDAH_ISOLATION=chroot +ENV STORAGE_DRIVER=vfs +ENV VERSION=10 +# Date for next build +ENV DATE="08:00 next Fri" + +# Add user for rootless build +RUN adduser build + +RUN dnf -y update +RUN dnf -y install vi buildah sqlite +RUN dnf -y clean all && \ + rm -rf /var/cache /var/log/dnf* + +RUN chmod u-s /usr/bin/newuidmap && \ + chmod u-s /usr/bin/newgidmap + +# Define uid/gid ranges for our user +# https://github.com/containers/buildah/issues/3053 +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 + +RUN (echo '[engine]';echo 'cgroup_manager = "cgroupfs"') > /etc/containers/containers.conf +RUN chmod 644 /etc/containers/containers.conf + +RUN echo "export BUILDAH_ISOLATION=chroot" >> /home/build/.bashrc +RUN mkdir -p /home/build/.local/share/containers + +# Adjust storage.conf to enable VFS since fuse dosen't work on Openshift +RUN mkdir -p /home/build/.config/containers && \ + (echo '[storage]';echo 'driver = "vfs"') > /home/build/.config/containers/storage.conf + +RUN mkdir -p /var/lib/shared/vfs-images \ + /var/lib/shared/vfs-layers && \ + touch /var/lib/shared/vfs-images/images.lock && \ + touch /var/lib/shared/vfs-layers/layers.lock + +COPY make-hyperscale-container.sh /home/build +COPY runner.sh /home/build +COPY validate/verify_rpmdb.sh /home/build +RUN chmod a+x /home/build/make-hyperscale-container.sh +RUN chmod a+x /home/build/runner.sh +RUN chmod a+x /home/build/verify_rpmdb.sh + +RUN chown build:build -R /home/build + +VOLUME /var/lib/containers +VOLUME /home/build/.local/share/containers + +USER build +WORKDIR /home/build + +ENTRYPOINT ["./runner.sh"]