From c95428b8575b2bdf91f847ce9f68c7b05b8ceace Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Thu, 22 Feb 2024 04:10:06 -0700 Subject: [PATCH] rpm: minimal RHEL support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjorn Neergaard Signed-off-by: Paweł Gronowski --- rpm/Makefile | 6 +++++- rpm/rhel-8/Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ rpm/rhel-9/Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 rpm/rhel-8/Dockerfile create mode 100644 rpm/rhel-9/Dockerfile diff --git a/rpm/Makefile b/rpm/Makefile index 9420b0a2e0..bf6ca1c372 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -10,11 +10,15 @@ CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD) BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD) +ifdef RH_USER + RH_FLAGS=--build-arg RH_USER=$(RH_USER) --build-arg RH_PASS=$(RH_PASS) +endif ifdef BUILD_IMAGE BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE) endif BUILD?=DOCKER_BUILDKIT=1 \ docker build \ + $(RH_FLAGS) \ $(BUILD_IMAGE_FLAG) \ --build-arg GO_IMAGE=$(GO_IMAGE) \ -t rpmbuild-$@/$(ARCH) \ @@ -59,7 +63,7 @@ RUN?=docker run --rm \ FEDORA_RELEASES ?= fedora-40 fedora-39 CENTOS_RELEASES ?= centos-9 -RHEL_RELEASES ?= +RHEL_RELEASES ?= rhel-8 rhel-9 DISTROS := $(FEDORA_RELEASES) $(CENTOS_RELEASES) $(RHEL_RELEASES) BUNDLES := $(patsubst %,rpmbuild/bundles-ce-%-$(DPKG_ARCH).tar.gz,$(DISTROS)) diff --git a/rpm/rhel-8/Dockerfile b/rpm/rhel-8/Dockerfile new file mode 100644 index 0000000000..1d26bb141c --- /dev/null +++ b/rpm/rhel-8/Dockerfile @@ -0,0 +1,36 @@ +# syntax=docker/dockerfile:1 + +ARG GO_IMAGE +ARG DISTRO=rhel +ARG SUITE=8 +ARG BUILD_IMAGE=registry.access.redhat.com/ubi8/ubi + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_IMAGE} AS subscribed-image +ARG RH_USER +ARG RH_PASS +RUN rm /etc/rhsm-host +RUN subscription-manager register --username=$RH_USER --password=$RH_PASS +RUN subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms +# RUN dnf config-manager --set-enabled codeready-builder-for-rhel-8-$(arch)-rpms + +FROM subscribed-image + +ENV GOPROXY=https://proxy.golang.org|direct +ENV GO111MODULE=off +ENV GOPATH=/go +ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin +ENV AUTO_GOPATH 1 +ENV DOCKER_BUILDTAGS exclude_graphdriver_btrfs +ARG DISTRO +ARG SUITE +ENV DISTRO=${DISTRO} +ENV SUITE=${SUITE} + +RUN dnf install -y rpm-build rpmlint +COPY --link SPECS /root/rpmbuild/SPECS +RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec +COPY --link --from=golang /usr/local/go /usr/local/go +WORKDIR /root/rpmbuild +ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/rhel-9/Dockerfile b/rpm/rhel-9/Dockerfile new file mode 100644 index 0000000000..3aa082045a --- /dev/null +++ b/rpm/rhel-9/Dockerfile @@ -0,0 +1,36 @@ +# syntax=docker/dockerfile:1 + +ARG GO_IMAGE +ARG DISTRO=rhel +ARG SUITE=9 +ARG BUILD_IMAGE=registry.access.redhat.com/ubi9/ubi + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_IMAGE} AS subscribed-image +ARG RH_USER +ARG RH_PASS +RUN rm /etc/rhsm-host +RUN subscription-manager register --username=$RH_USER --password=$RH_PASS +RUN subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms +# RUN dnf config-manager --set-enabled codeready-builder-for-rhel-9-$(arch)-rpms + +FROM subscribed-image + +ENV GOPROXY=https://proxy.golang.org|direct +ENV GO111MODULE=off +ENV GOPATH=/go +ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin +ENV AUTO_GOPATH 1 +ENV DOCKER_BUILDTAGS exclude_graphdriver_btrfs +ARG DISTRO +ARG SUITE +ENV DISTRO=${DISTRO} +ENV SUITE=${SUITE} + +RUN dnf install -y rpm-build rpmlint +COPY --link SPECS /root/rpmbuild/SPECS +RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec +COPY --link --from=golang /usr/local/go /usr/local/go +WORKDIR /root/rpmbuild +ENTRYPOINT ["/bin/rpmbuild"]