mirror of
https://github.com/ceph/ceph
synced 2025-03-21 01:38:15 +00:00
build: add files needed to create a build container
A build container contains all the tools and dependencies needed to
build ceph. It provides a Container file and small script that
helps bootstrap the container setup. This script installs a few extra
things we need before farming most of the work out to install-deps.sh.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit bde72fc478
)
This commit is contained in:
parent
76f2cf0836
commit
17ceb1dc27
32
Dockerfile.build
Normal file
32
Dockerfile.build
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
ARG DISTRO
|
||||||
|
|
||||||
|
FROM scratch as bootstrap
|
||||||
|
ARG CEPH_CTR_SRC=/usr/local/src/ceph
|
||||||
|
COPY \
|
||||||
|
src/script/lib-build.sh \
|
||||||
|
src/script/run-make.sh \
|
||||||
|
${CEPH_CTR_SRC}/src/script/
|
||||||
|
COPY debian ${CEPH_CTR_SRC}/debian
|
||||||
|
COPY \
|
||||||
|
ceph.spec.in \
|
||||||
|
do_cmake.sh \
|
||||||
|
install-deps.sh \
|
||||||
|
run-make-check.sh \
|
||||||
|
src/script/buildcontainer-setup.sh \
|
||||||
|
${CEPH_CTR_SRC}
|
||||||
|
|
||||||
|
|
||||||
|
FROM $DISTRO
|
||||||
|
ENV FOR_MAKE_CHECK=1
|
||||||
|
ARG DISTRO
|
||||||
|
ARG CEPH_CTR_SRC=/usr/local/src/ceph
|
||||||
|
ARG CLEAN_DNF=yes
|
||||||
|
ARG CEPH_BRANCH=main
|
||||||
|
COPY --from=bootstrap ${CEPH_CTR_SRC} ${CEPH_CTR_SRC}
|
||||||
|
# Note that we do not use ENV for the following. This is because we do not
|
||||||
|
# want them permamently stored in the container's layer.
|
||||||
|
RUN DISTRO=$DISTRO \
|
||||||
|
CEPH_BRANCH=$CEPH_BRANCH \
|
||||||
|
CLEAN_DNF=$CLEAN_DNF \
|
||||||
|
CEPH_CTR_SRC=${CEPH_CTR_SRC} \
|
||||||
|
bash -x ${CEPH_CTR_SRC}/buildcontainer-setup.sh
|
49
src/script/buildcontainer-setup.sh
Normal file
49
src/script/buildcontainer-setup.sh
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
install_container_deps() {
|
||||||
|
source ./src/script/run-make.sh
|
||||||
|
prepare
|
||||||
|
}
|
||||||
|
|
||||||
|
dnf_clean() {
|
||||||
|
if [ "${CLEAN_DNF}" != no ]; then
|
||||||
|
dnf clean all
|
||||||
|
rm -rf /var/cache/dnf/*
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set -e
|
||||||
|
export LOCALE=C
|
||||||
|
cd ${CEPH_CTR_SRC}
|
||||||
|
|
||||||
|
# If DISTRO_KIND is not already set, derive it from the container's os-release.
|
||||||
|
if [ -z "$DISTRO_KIND" ]; then
|
||||||
|
. /etc/os-release
|
||||||
|
DISTRO_KIND="${ID}:${VERSION_ID}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute a container setup process, installing the packges needed to build
|
||||||
|
# ceph for the given <branch>~<distro_kind> pair. Some distros need extra
|
||||||
|
# tools in the container image vs. vm hosts or extra tools needed to build
|
||||||
|
# packages etc.
|
||||||
|
case "${CEPH_BRANCH}~${DISTRO_KIND}" in
|
||||||
|
*~*centos*8)
|
||||||
|
dnf install -y java-1.8.0-openjdk-headless /usr/bin/rpmbuild wget
|
||||||
|
install_container_deps
|
||||||
|
dnf_clean
|
||||||
|
;;
|
||||||
|
*~*centos*9|*~*centos*10*|*~fedora*)
|
||||||
|
dnf install -y /usr/bin/rpmbuild wget
|
||||||
|
install_container_deps
|
||||||
|
dnf_clean
|
||||||
|
;;
|
||||||
|
*~*ubuntu*)
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y wget reprepro
|
||||||
|
install_container_deps
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown action, branch or build: ${CEPH_BRANCH}~${DISTRO_KIND}" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user