Skip to content

Commit bde72fc

Browse files
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 <[email protected]>
1 parent 4578625 commit bde72fc

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

Dockerfile.build

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ARG DISTRO
2+
3+
FROM scratch as bootstrap
4+
ARG CEPH_CTR_SRC=/usr/local/src/ceph
5+
COPY \
6+
src/script/lib-build.sh \
7+
src/script/run-make.sh \
8+
${CEPH_CTR_SRC}/src/script/
9+
COPY debian ${CEPH_CTR_SRC}/debian
10+
COPY \
11+
ceph.spec.in \
12+
do_cmake.sh \
13+
install-deps.sh \
14+
run-make-check.sh \
15+
src/script/buildcontainer-setup.sh \
16+
${CEPH_CTR_SRC}
17+
18+
19+
FROM $DISTRO
20+
ENV FOR_MAKE_CHECK=1
21+
ARG DISTRO
22+
ARG CEPH_CTR_SRC=/usr/local/src/ceph
23+
ARG CLEAN_DNF=yes
24+
ARG CEPH_BRANCH=main
25+
COPY --from=bootstrap ${CEPH_CTR_SRC} ${CEPH_CTR_SRC}
26+
# Note that we do not use ENV for the following. This is because we do not
27+
# want them permamently stored in the container's layer.
28+
RUN DISTRO=$DISTRO \
29+
CEPH_BRANCH=$CEPH_BRANCH \
30+
CLEAN_DNF=$CLEAN_DNF \
31+
CEPH_CTR_SRC=${CEPH_CTR_SRC} \
32+
bash -x ${CEPH_CTR_SRC}/buildcontainer-setup.sh

src/script/buildcontainer-setup.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
install_container_deps() {
4+
source ./src/script/run-make.sh
5+
prepare
6+
}
7+
8+
dnf_clean() {
9+
if [ "${CLEAN_DNF}" != no ]; then
10+
dnf clean all
11+
rm -rf /var/cache/dnf/*
12+
fi
13+
}
14+
15+
set -e
16+
export LOCALE=C
17+
cd ${CEPH_CTR_SRC}
18+
19+
# If DISTRO_KIND is not already set, derive it from the container's os-release.
20+
if [ -z "$DISTRO_KIND" ]; then
21+
. /etc/os-release
22+
DISTRO_KIND="${ID}:${VERSION_ID}"
23+
fi
24+
25+
# Execute a container setup process, installing the packges needed to build
26+
# ceph for the given <branch>~<distro_kind> pair. Some distros need extra
27+
# tools in the container image vs. vm hosts or extra tools needed to build
28+
# packages etc.
29+
case "${CEPH_BRANCH}~${DISTRO_KIND}" in
30+
*~*centos*8)
31+
dnf install -y java-1.8.0-openjdk-headless /usr/bin/rpmbuild wget
32+
install_container_deps
33+
dnf_clean
34+
;;
35+
*~*centos*9|*~*centos*10*|*~fedora*)
36+
dnf install -y /usr/bin/rpmbuild wget
37+
install_container_deps
38+
dnf_clean
39+
;;
40+
*~*ubuntu*)
41+
apt-get update
42+
apt-get install -y wget reprepro
43+
install_container_deps
44+
;;
45+
*)
46+
echo "Unknown action, branch or build: ${CEPH_BRANCH}~${DISTRO_KIND}" >&2
47+
exit 2
48+
;;
49+
esac

0 commit comments

Comments
 (0)