From 518139087371c0345aa9759c418fbd01e6ccd217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Tue, 27 Aug 2024 11:45:40 +0200 Subject: [PATCH] Add package for AlmaLinux EL compatible Should be compatible with CentOS and RHEL Remove dependency for libcgroup, on .el9 --- packaging/README.md | 2 ++ packaging/rpm/Makefile | 12 ++++++++---- packaging/rpm/SPECS/cri-dockerd.spec | 3 +++ packaging/rpm/almalinux-8/Dockerfile | 24 ++++++++++++++++++++++++ packaging/rpm/almalinux-9/Dockerfile | 24 ++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 packaging/rpm/almalinux-8/Dockerfile create mode 100644 packaging/rpm/almalinux-9/Dockerfile diff --git a/packaging/README.md b/packaging/README.md index eb6781783..effb5962f 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -13,4 +13,6 @@ The scripts will build for this list of packages types: * DEB packages for Debian 9 Stretch * RPM packages for Fedora 40 * RPM packages for Fedora 39 +* RPM packages for AlmaLinux 8 +* RPM packages for AlmaLinux 9 * TGZ and ZIP files with static binaries diff --git a/packaging/rpm/Makefile b/packaging/rpm/Makefile index abd2ed9e8..e355d4c11 100644 --- a/packaging/rpm/Makefile +++ b/packaging/rpm/Makefile @@ -44,6 +44,7 @@ SOURCES=$(addprefix rpmbuild/SOURCES/, $(SOURCE_FILES)) FEDORA_RELEASES := fedora-39 fedora-40 CENTOS_RELEASES := +ALMALINUX_RELEASES := almalinux-8 almalinux-9 .PHONY: help help: ## show make targets @@ -55,16 +56,19 @@ clean: ## remove build artifacts $(RM) -r rpmbuild/ .PHONY: rpm -rpm: fedora centos ## build all rpm packages +rpm: fedora centos almalinux ## build all rpm packages .PHONY: fedora fedora: $(FEDORA_RELEASES) ## build all fedora rpm packages .PHONY: centos -centos: $(CENTOS_RELEASES) ## build all centos rpm packages +centos: $(CENTOS_RELEASES) ## build all centos stream rpm packages -.PHONY: $(FEDORA_RELEASES) $(CENTOS_RELEASES) -$(FEDORA_RELEASES) $(CENTOS_RELEASES): $(SOURCES) +.PHONY: almalinux +almalinux: $(ALMALINUX_RELEASES) ## build all almalinux rpm packages + +.PHONY: $(FEDORA_RELEASES) $(CENTOS_RELEASES) $(ALMALINUX_RELEASES) +$(FEDORA_RELEASES) $(CENTOS_RELEASES) $(ALMALINUX_RELEASES): $(SOURCES) @echo "${APP_DIR}" @echo "${VERSION}" @echo "$(shell ./gen-rpm-ver $(APP_DIR) $(VERSION))" diff --git a/packaging/rpm/SPECS/cri-dockerd.spec b/packaging/rpm/SPECS/cri-dockerd.spec index a5be5a1c5..ac5ca2e1b 100644 --- a/packaging/rpm/SPECS/cri-dockerd.spec +++ b/packaging/rpm/SPECS/cri-dockerd.spec @@ -25,8 +25,11 @@ Requires: (iptables or nftables) Requires: iptables %endif %if %{undefined suse_version} +%if %{undefined rhel} || 0%{?rhel} < 9 +# Libcgroup is no longer available in RHEL/CentOS >= 9 distros. Requires: libcgroup %endif +%endif Requires: containerd.io >= 1.2.2-3 Requires: tar Requires: xz diff --git a/packaging/rpm/almalinux-8/Dockerfile b/packaging/rpm/almalinux-8/Dockerfile new file mode 100644 index 000000000..c34f3ddec --- /dev/null +++ b/packaging/rpm/almalinux-8/Dockerfile @@ -0,0 +1,24 @@ +ARG GO_IMAGE +ARG DISTRO=almalinux +ARG SUITE=8 +ARG BUILD_IMAGE=${DISTRO}:${SUITE} + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_IMAGE} +ARG DISTRO +ARG SUITE +ENV DISTRO ${DISTRO} +ENV SUITE ${SUITE} +ENV GOPROXY=direct +ENV GOPATH=/go +ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin +ENV AUTO_GOPATH 1 +ENV DOCKER_BUILDTAGS seccomp selinux +ENV RUNC_BUILDTAGS seccomp selinux +RUN yum install -y rpm-build rpmlint +COPY SPECS /root/rpmbuild/SPECS +RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec +COPY --from=golang /usr/local/go /usr/local/go/ +WORKDIR /root/rpmbuild +ENTRYPOINT ["/bin/rpmbuild"] diff --git a/packaging/rpm/almalinux-9/Dockerfile b/packaging/rpm/almalinux-9/Dockerfile new file mode 100644 index 000000000..0bd433847 --- /dev/null +++ b/packaging/rpm/almalinux-9/Dockerfile @@ -0,0 +1,24 @@ +ARG GO_IMAGE +ARG DISTRO=almalinux +ARG SUITE=9 +ARG BUILD_IMAGE=${DISTRO}:${SUITE} + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_IMAGE} +ARG DISTRO +ARG SUITE +ENV DISTRO ${DISTRO} +ENV SUITE ${SUITE} +ENV GOPROXY=direct +ENV GOPATH=/go +ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin +ENV AUTO_GOPATH 1 +ENV DOCKER_BUILDTAGS seccomp selinux +ENV RUNC_BUILDTAGS seccomp selinux +RUN yum install -y rpm-build rpmlint +COPY SPECS /root/rpmbuild/SPECS +RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec +COPY --from=golang /usr/local/go /usr/local/go/ +WORKDIR /root/rpmbuild +ENTRYPOINT ["/bin/rpmbuild"]