diff --git a/rpm/Makefile b/rpm/Makefile index 84d9c9d86e..01bf1f9f75 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -13,7 +13,7 @@ SCAN_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/scan-cl BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD) ifdef BUILD_IMAGE - BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE) + BUILD_IMAGE_FLAG=--build-arg BUILD_IMAGE=$(BUILD_IMAGE) endif BUILD?=DOCKER_BUILDKIT=1 \ docker build \ @@ -61,7 +61,7 @@ RUN?=docker run --rm \ FEDORA_RELEASES ?= fedora-37 fedora-36 fedora-35 CENTOS_RELEASES ?= centos-7 centos-8 centos-9 ifeq ($(ARCH),s390x) -RHEL_RELEASES ?= rhel-7 +RHEL_RELEASES ?= rhel-7 rhel-8 rhel-9 else RHEL_RELEASES ?= endif @@ -80,7 +80,7 @@ clean: ## remove build artifacts -docker builder prune -f --filter until=24h .PHONY: rpm -rpm: fedora centos ## build all rpm packages +rpm: fedora centos rhel ## build all rpm packages .PHONY: fedora fedora: $(FEDORA_RELEASES) ## build all fedora rpm packages @@ -91,6 +91,9 @@ centos-8 centos-9: RPMBUILD_EXTRA_FLAGS=--define '_without_btrfs 1' .PHONY: centos centos: $(CENTOS_RELEASES) ## build all centos rpm packages +.PHONY: rhel-8 rhel-9 +rhel-8 rhel-9: RPMBUILD_EXTRA_FLAGS=--define '_without_btrfs 1' + .PHONY: rhel rhel: $(RHEL_RELEASES) ## build all rhel rpm packages diff --git a/rpm/rhel-8/Dockerfile b/rpm/rhel-8/Dockerfile new file mode 100644 index 0000000000..ebe324dd07 --- /dev/null +++ b/rpm/rhel-8/Dockerfile @@ -0,0 +1,34 @@ +ARG GO_IMAGE +ARG DISTRO=rhel +ARG SUITE=8 +ARG BUILD_IMAGE=dockereng/${DISTRO}:${SUITE}-s390x + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_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 yum install -y rpm-build rpmlint libarchive yum-utils +COPY SPECS /root/rpmbuild/SPECS + +# TODO change once we support scan-plugin on other architectures +RUN \ + if [ "$(uname -m)" = "x86_64" ]; then \ + yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \ + else \ + yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \ + yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \ + fi + +COPY --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..724eec057f --- /dev/null +++ b/rpm/rhel-9/Dockerfile @@ -0,0 +1,34 @@ +ARG GO_IMAGE +ARG DISTRO=rhel +ARG SUITE=9 +ARG BUILD_IMAGE=dockereng/${DISTRO}:${SUITE}-s390x + +FROM ${GO_IMAGE} AS golang + +FROM ${BUILD_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 yum install -y rpm-build rpmlint libarchive yum-utils +COPY SPECS /root/rpmbuild/SPECS + +# TODO change once we support scan-plugin on other architectures +RUN \ + if [ "$(uname -m)" = "x86_64" ]; then \ + yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \ + else \ + yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \ + yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \ + fi + +COPY --from=golang /usr/local/go /usr/local/go +WORKDIR /root/rpmbuild +ENTRYPOINT ["/bin/rpmbuild"]