Migrate docker support to meson
- bmcweb seems to have x86 docker support which was broken
due to build system migration.
- This commit would migrate the docker to leverage the meson
build system.
- There are a couple of changes that are needed to for meson :
- Right now meson does not support the subprojects to be downloaded
elsewhere other than subprojects directory, because of that we
cannot delete the source directory in the bmcweb-base container as
that affect the incremental builds.
- Docker infrastructure had now does not by-default allow DNS lookups
for the latest rpm-based distributions, because of which I need to
add --network to the base container(so that apt update succeeds)
Tested By:
- Was able to successfully compile bmcweb & tests in a container and
was able to get the build directory out of the container to the host
machine post completion.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: Ica23bd3de22e262a27c91167181161fc459cda0d
diff --git a/Dockerfile b/Dockerfile
index 978a4c3..8155764 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@
ADD . /source
-RUN cmake --build .
+RUN ninja -C /source/build
RUN mkdir -p /usr/share/www
diff --git a/Dockerfile.base b/Dockerfile.base
index ca12ab7..d4d2974 100644
--- a/Dockerfile.base
+++ b/Dockerfile.base
@@ -3,13 +3,13 @@
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
apt-get install -y libpam0g-dev libssl-dev zlib1g-dev pkg-config xxd cmake \
libgtest-dev libgmock-dev ninja-build python3 autoconf-archive autoconf \
- build-essential git libsystemd-dev systemd python3-wheel python3-pip \
+ build-essential git libsystemd-dev systemd libtinyxml2-dev python3-wheel python3-pip \
python3-yaml python3-mako python3-inflection python3-setuptools && \
pip3 install meson
ADD . /source
-RUN mkdir -p /build && cd /build && cmake -DYOCTO_DEPENDENCIES=OFF /source && \
- cmake --build . && rm -rf /source
+RUN cd source && meson setup build && \
+ meson compile -C build
WORKDIR /build
diff --git a/build_x86_docker.sh b/build_x86_docker.sh
index 3f57b77..ef9b24a 100755
--- a/build_x86_docker.sh
+++ b/build_x86_docker.sh
@@ -8,10 +8,8 @@
fi
docker inspect bmcweb-base > /dev/null ||
- docker build --no-cache --force-rm -t bmcweb-base -f Dockerfile.base .
+ docker build --network=host --no-cache --force-rm -t bmcweb-base -f Dockerfile.base .
docker build -t bmcweb .
-mkdir -p build
-
-docker run -v "$PWD":/app -it bmcweb cp -r /build/bmcweb /build/webtest /app/build
+docker run -v "$PWD":/app -it bmcweb cp -rf /source/build/ /app/build