Skip to content

Commit c5b92a8

Browse files
jfsmigfatpat
authored andcommitted
docker: Add a Dockerfile to run the build matrix
1 parent 39e578d commit c5b92a8

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22

33
Gridinit is a tool used to manage non-daemon processes.
44

5+
## Supported Linux Distributions
6+
7+
* Ubuntu
8+
* Trusty
9+
* Xenial
10+
* Bionic
11+
* Focal
12+
13+
Wanna check? Then use the [build_all.sh script](./docker/build_all.sh) that
14+
relies on our [Dockerfile](./docker/Dockerfile) to reproduce minimal build
15+
environments.
16+
517
## Dependencies
618

719
* A toolchain made of [cmake](https://cmake.org),
820
[make](https://www.gnu.org/software/make/),
921
[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/),
1022
[gcc](https://www.gnu.org/software/gcc/) or [clang](https://clang.llvm.org/)
1123
* The [GNome Library](https://developer.gnome.org/glib/stable/)
12-
* [Martin Sustrik's libdill](https://github.com/open-io/libdill)
24+
* [Martin Sustrik's libdill](https://github.com/open-io/libdill) in its OpenIO supported version.
1325

1426
## Build
1527

docker/Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
ARG DISTRO
2+
FROM ubuntu:${DISTRO} as gridinit-base
3+
4+
LABEL maintainer "Jean-Francois SMIGIELSKI <jf.smigielski@gmail.com>"
5+
6+
ARG DEBIAN_FRONTEND=noninteractive
7+
ARG DEBCONF_NONINTERACTIVE_SEEN=true
8+
9+
RUN set -ex && \
10+
echo "tzdata tzdata/Areas select Europe" > /tmp/preseed.txt; \
11+
echo "tzdata tzdata/Zones/Europe select Brussels" >> /tmp/preseed.txt; \
12+
debconf-set-selections /tmp/preseed.txt && \
13+
apt-get update -q && \
14+
apt-get install -y --no-install-recommends tzdata pkg-config software-properties-common
15+
16+
17+
#------------------------------------------------------------------------------#
18+
# Build and Install the exotic dependencies of gridinit
19+
20+
FROM gridinit-base as gridinit-build-deps
21+
22+
RUN set -ex && \
23+
# Deps
24+
apt-get update -q && \
25+
apt-get install -y --no-install-recommends git autoconf automake autotools-dev build-essential m4 libtool && \
26+
# Checkout
27+
cd /tmp && \
28+
git clone https://github.com/open-io/libdill.git && \
29+
cd /tmp/libdill && \
30+
git checkout e738f9661a5f63c219ea3a7e8627237b5fa0d9c0 && \
31+
# Build
32+
cd /tmp/libdill && \
33+
./autogen.sh && \
34+
./configure --prefix=/usr --enable-static --enable-shared && \
35+
make -j $(nproc --ignore=2) && \
36+
make install && \
37+
# Cleanup
38+
apt-get remove -y --purge git autoconf automake autotools-dev build-essential m4 libtool && \
39+
apt-get autoremove -y --purge && \
40+
rm -rf /tmp/libdill
41+
42+
ENTRYPOINT ["/bin/bash"]
43+
44+
45+
#------------------------------------------------------------------------------#
46+
# Install the sources and the minimal tooling to build gridinit
47+
48+
FROM gridinit-build-deps
49+
50+
RUN set -ex && \
51+
apt-get update -q && \
52+
apt-get install -y --no-install-recommends cmake clang gcc jq libglib2.0-dev make pkg-config
53+
54+
RUN set -ex && \
55+
mkdir /tmp/src
56+
57+
COPY main /tmp/src/main/
58+
COPY CMakeLists.txt /tmp/src/
59+
COPY docker/build.sh /tmp/
60+
61+
CMD ["/tmp/build.sh"]
62+

docker/build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
COMPILERS=$@
5+
if [[ -z "${COMPILERS}" ]] ; then
6+
COMPILERS="gcc clang"
7+
fi
8+
9+
NPROCS=$(nproc --ignore=2)
10+
11+
for BUILD in Debug Release RelWithDebInfo MinSizeRel ; do
12+
for COMPILER in $COMPILERS ; do
13+
TAG="${BUILD}-${COMPILER}"
14+
D=/tmp/build-${TAG}
15+
mkdir ${D}
16+
cd ${D}
17+
export CC=${COMPILER}
18+
cmake -DCMAKE_INSTALL_PREFIX=/tmp/install-${TAG} -DCMAKE_BUILD_TYPE=${BUILD} /tmp/src
19+
make -j $NPROCS
20+
make install
21+
done
22+
done
23+

docker/build_all.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
for DISTRO in trusty xenial bionic focal ; do
5+
docker build --build-arg DISTRO=${DISTRO} --tag gridinit-test-${DISTRO} -f docker/Dockerfile .
6+
docker run gridinit-test-${DISTRO}
7+
done
8+
9+
# Unsupported: ubuntu:{yakkety,zesty,artful,cosmic,disco,eoan,groovy}

0 commit comments

Comments
 (0)