SLES 15 SP2 RPM - anujajakhade/anuja GitHub Wiki
- Build containerd RPMS
1. cd $SOURCE_ROOT/go/src/github.com/docker
2. git clone https://github.com/docker/containerd-packaging
3. cd containerd-packaging
- Do the following changes
diff --git a/Makefile b/Makefile
index 201c10f..e8e9b84 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@
include common/common.mk
-BUILD_IMAGE=centos:7
+BUILD_IMAGE=ecos0003:5000/sles:15-sp2
BUILD_TYPE=$(shell ./scripts/deb-or-rpm $(BUILD_IMAGE))
BUILD_BASE=$(shell ./scripts/determine-base $(BUILD_IMAGE))
@@ -89,13 +89,12 @@ build:
@echo "golang image : $(GOLANG_IMAGE)"
@echo "--------------------------------------------------------------------"
@docker pull "$(BUILD_IMAGE)"
@if [ -z "$(BUILD_BASE)" ]; then echo "Invalid build image $(BUILD_IMAGE) no build base found"; exit 1; fi
@if [ -z "$(BUILD_TYPE)" ]; then echo "Invalid build image $(BUILD_IMAGE) no build type found"; exit 1; fi
@set -x; DOCKER_BUILDKIT=1 docker build \
- --pull \
--build-arg GOLANG_IMAGE="$(GOLANG_IMAGE)" \
--build-arg BUILD_IMAGE="$(BUILD_IMAGE)" \
--build-arg BASE="$(BUILD_BASE)" \
diff --git a/dockerfiles/rpm.dockerfile b/dockerfiles/rpm.dockerfile
index 0382ae0..56cc4a2 100644
--- a/dockerfiles/rpm.dockerfile
+++ b/dockerfiles/rpm.dockerfile
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-ARG BUILD_IMAGE=centos:7
+ARG BUILD_IMAGE=ecos0003:5000/jenkins_slave_sles:12-sp5
ARG BASE=centos
ARG GOLANG_IMAGE=golang:latest
diff --git a/rpm/containerd.spec b/rpm/containerd.spec
index 04caeeb..985c0d9 100644
--- a/rpm/containerd.spec
+++ b/rpm/containerd.spec
@@ -58,8 +58,12 @@ Source3: runc
%if "%{?dist}" != ".amzn2"
Requires: container-selinux >= 2:2.74
%endif
+%if 0%{?sles}
+Requires: libseccomp2=2.3.1
+%else
Requires: libseccomp
%endif
+%endif
BuildRequires: make
BuildRequires: gcc
BuildRequires: systemd
5. make REF=v1.5.2 BUILD_IMAGE=ecos0003:5000/jenkins_slave_sles:15-sp2 build
- Build DOCKER-CE RPMS
1. cd $SOURCE_ROOT/go/src/github.com/docker
2. PACKAGE_VERSION="20.10.7"
3. git clone --depth 1 -b 20.10 https://github.com/docker/docker-ce-packaging
4. cd docker-ce-packaging
5. make DOCKER_CLI_REF=v$PACKAGE_VERSION DOCKER_ENGINE_REF=v$PACKAGE_VERSION checkout
- Do the following changes.
diff --git a/rpm/Makefile b/rpm/Makefile
index b6e18c7..a4abcf7 100644
--- a/rpm/Makefile
+++ b/rpm/Makefile
@@ -29,6 +29,7 @@ endif
SPECS?=$(addprefix SPECS/, $(SPEC_FILES))
RPMBUILD_FLAGS?=-ba\
+ --define '_without_btrfs 1' \
--define '_gitcommit_cli $(CLI_GITCOMMIT)' \
--define '_gitcommit_engine $(ENGINE_GITCOMMIT)' \
--define '_release $(word 2,$(GEN_RPM_VER))' \
@@ -44,9 +45,9 @@ RPMBUILD_FLAGS?=-ba\
RUN_FLAGS=
RUN?=docker run --rm \
-e PLATFORM \
- -v $(CURDIR)/rpmbuild/SOURCES:/root/rpmbuild/SOURCES:ro \
- -v $(CURDIR)/rpmbuild/$@/RPMS:/root/rpmbuild/RPMS \
- -v $(CURDIR)/rpmbuild/$@/SRPMS:/root/rpmbuild/SRPMS \
+ -v $(CURDIR)/rpmbuild/SOURCES:/usr/src/packages/SOURCES:ro \
+ -v $(CURDIR)/rpmbuild/$@/RPMS:/usr/src/packages/RPMS \
+ -v $(CURDIR)/rpmbuild/$@/SRPMS:/usr/src/packages/SRPMS \
$(RUN_FLAGS) \
rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS)
@@ -57,8 +58,9 @@ RHEL_RELEASES ?= rhel-7
else
RHEL_RELEASES ?=
endif
+SLES_RELEASES ?= sles-15
-DISTROS := $(FEDORA_RELEASES) $(CENTOS_RELEASES) $(RHEL_RELEASES)
+DISTROS := $(FEDORA_RELEASES) $(CENTOS_RELEASES) $(RHEL_RELEASES) $(SLES_RELEASES)
BUNDLES := $(patsubst %,rpmbuild/bundles-ce-%-$(DPKG_ARCH).tar.gz,$(DISTROS))
.PHONY: help
@@ -86,6 +88,9 @@ centos: $(CENTOS_RELEASES) ## build all centos rpm packages
.PHONY: rhel
rhel: $(RHEL_RELEASES) ## build all rhel rpm packages
+.PHONY: sles
+sles: $(SLES_RELEASES) ## build all sles rpm packages
+
.PHONY: $(DISTROS)
$(DISTROS): rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/scan-cli-plugin.tgz rpmbuild/SOURCES/docker.service rpmbuild/SOURCES/docker.socket rpmbuild/SOURCES/plugin-installers.tgz
@echo "== Building packages for $@ =="
diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec
index f4e60b1..ae081d9 100644
--- a/rpm/SPECS/docker-ce.spec
+++ b/rpm/SPECS/docker-ce.spec
@@ -20,11 +20,11 @@ Packager: Docker <[email protected]>
Requires: /usr/sbin/groupadd
Requires: docker-ce-cli
Requires: docker-ce-rootless-extras
-Requires: container-selinux >= 2:2.74
-Requires: libseccomp >= 2.3
+Requires: container-selinux
+Requires: libseccomp2
Requires: systemd
Requires: iptables
-Requires: libcgroup
+Requires: libcgroup-devel
Requires: containerd.io >= 1.4.1
Requires: tar
Requires: xz
- Create a
docker-ce-packaging/rpm/sles-15/Dockerfile
with contents below
ARG GO_IMAGE
ARG DISTRO=sles
ARG SUITE=15.2
ARG BUILD_IMAGE=ecos0003:5000/sles:15-sp2
FROM ${GO_IMAGE} AS golang
FROM ${BUILD_IMAGE}
ENV GOPROXY=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 seccomp selinux
ENV RUNC_BUILDTAGS seccomp selinux
ARG DISTRO
ARG SUITE
ENV DISTRO=${DISTRO}
ENV SUITE=${SUITE}
ENV CC=gcc
USER root
# In aarch64 (arm64) images, the altarch repo is specified as repository, but
# failing, so replace the URL.
RUN zypper install -y rpm-build rpmlint pkg-config libsystemd0 systemd-devel selinux-tools wget
RUN zypper install -y cmake device-mapper-devel git glibc-devel-static libseccomp-devel libtool
COPY SPECS /usr/src/packages/SPECS
COPY rpmbuild/SOURCES/ /usr/src/packages/SOURCES/
COPY sles-15/policycoreutils-3.2-1.s390x.rpm /root/
COPY sles-15/checkpolicy-3.2.61.1-1.s390x.rpm /root/
RUN rpm -i /root/policycoreutils-3.2-1.s390x.rpm && rpm -i /root/checkpolicy-3.2.61.1-1.s390x.rpm
RUN zypper addrepo https://download.opensuse.org/repositories/security:SELinux/SLE_15_SP2/security:SELinux.repo \
&& zypper --gpg-auto-import-keys refresh && zypper install -y selinux-policy selinux-policy-devel
#RUN wget https://download.opensuse.org/repositories/security:/SELinux/SLE_15_SP2/noarch/selinux-policy-20210419-105.1.noarch.rpm && rpm -i selinux-#policy-20210419-105.1.noarch.rpm
#RUN wget https://download.opensuse.org/repositories/security:/SELinux/SLE_15_SP2/noarch/selinux-policy-devel-20210419-105.1.noarch.rpm && rpm -i #selinux-policy-devel-20210419-105.1.noarch.rpm
RUN mkdir -p /root/rpmbuild/SPECS/ && cp -r /usr/src/packages/SPECS/* /root/rpmbuild/SPECS/
# TODO change once we support scan-plugin on other architectures
RUN \
if [ "$(uname -m)" = "x86" ]; then \
rpmbuild /root/rpmbuild/SPECS/*.spec; \
else \
rpmbuild /usr/src/packages/SPECS/docker-c*.spec; \
fi
COPY --from=golang /usr/local/go /usr/local/go
WORKDIR /root/rpmbuild
ENTRYPOINT ["/usr/bin/rpmbuild"]
7.Generate rpm for policycoreutils and checkpolicy
sudo zypper install -y rpmbuild
cd /usr/src/package/SPECS
NOTE: While generating rpms make sure that all required tar files are in BUILD dir
- Create
checkpolicy.spec
in/usr/src/packages/SPECS
# spec file for package slirp4netns
#
# Copyright (c) 2021 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: checkpolicy
Version: 3.2.61.1
Release: 1%{?dist}
Group: System Environment/Base
Summary: policycoreutils package
License: GPLv3+
%description
%configure
%install
mkdir -p %{buildroot}/
cp -r ./* %{buildroot}/
sudo zypper install wget tar gcc7 make gzip bison libsepol-devel flex
tar -xvf libsepol-3.2.tar.gz
cd libsepol-3.2
make CC=gcc
cd ..
tar -xvf checkpolicy-3.2.tar.gz
cd checkpolicy-3.2
make CC=gcc
%clean
%files
/*
- Create
policycoreutils
in/usr/src/packages/SPECS
#
# spec file for package slirp4netns
#
# Copyright (c) 2021 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: policycoreutils
Version: 3.2
Release: 1%{?dist}
Group: System Environment/Base
Summary: policycoreutils package
License: GPLv3+
%description
%configure
%install
mkdir -p %{buildroot}/
cp -r ./* %{buildroot}/
sudo zypper install -y gzip make gcc7 flex libbz2-devel libsemanage-devel gettext bison wget tar
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
tar -xvf libsepol-3.2.tar.gz
cd libsepol-3.2
make CC=gcc
sudo make install
cd ..
tar -xvf libselinux-3.2.tar.gz
cd libselinux-3.2
make CC=gcc
sudo make install
cd ..
tar -xvf policycoreutils-3.2.tar.gz
cd policycoreutils-3.2
make CC=gcc
sudo make install
%clean
%files
/*
- Build rpms using commmand
rpmbuild -bb policycoreutils.spec
rpmbuild -bb checkpolicy.spec
cp /usr/src/packages/RPMS/s390x/policycoreutils-3.2-1.s390x.rpm /$SOURCE_ROOT/go/src/github.com/docker/docker-ce-packaging/rpm/sles-15
cp /usr/src/packages/RPMS/s390x/checkpolicy-3.2.61.1-1.s390x.rpm /$SOURCE_ROOT/go/src/github.com/docker/docker-ce-packaging/rpm/sles-15
cd $SOURCE_ROOT/go/src/github.com/docker/docker-ce-packaging/rpm
9. make VERSION=$PACKAGE_VERSION sles
10 make VERSION=20.10.7 sles rpmbuild/bundles-ce-sles-15-s390x.tar.gz
- Installing the
docker-ce-*
RPMS
mkdir -p /home/test/repo/
sudo chown -R root.root /home/test/repo/
#copy all rpms to repo folder
sudo cp * /home/test/repo/
sudo zypper install createrepo
sudo createrepo /home/test/repo/
sudo chmod -R o-w+r /home/test/repo/
sudo vi /etc/zypp/repos.d/myrepo.repo #/etc/zypp/repos.d
[local]
name=Local Docker-ce Repo
baseurl=file:///home/test/repo/
enabled=1
gpgcheck=0
zypper addrepo https://download.opensuse.org/repositories/security:SELinux/SLE_15_SP2/security:SELinux.repo
zypper --gpg-auto-import-keys refresh
cp /usr/src/packages/RPMS/s390x/policycoreutils-3.2-1.s390x.rpm /home/test/repo/
sudo zypper install -y docker-ce