|
| 1 | +# Usage: |
| 2 | +# docker build -f Dockerfile.fedora . |
| 3 | +# docker build -f Dockerfile.fedora --build-arg FEDORA_VERSION=41 --build-arg DDS_VERSION=3.17 . |
| 4 | +# docker build -f Dockerfile.fedora --build-arg BOOST_VERSION=90 . |
| 5 | + |
| 6 | +# Stage 1: Common build environment with shared dnf packages. |
| 7 | +ARG FEDORA_VERSION=42 |
| 8 | +FROM fedora:${FEDORA_VERSION} AS buildenv |
| 9 | + |
| 10 | +RUN dnf -y update && \ |
| 11 | + dnf -y install abseil-cpp-devel \ |
| 12 | + asio-devel \ |
| 13 | + ca-certificates \ |
| 14 | + cmake \ |
| 15 | + flatbuffers-devel \ |
| 16 | + flatbuffers-compiler \ |
| 17 | + fmt-devel \ |
| 18 | + gcc-c++ \ |
| 19 | + git \ |
| 20 | + grpc-devel \ |
| 21 | + grpc-plugins \ |
| 22 | + libxml2 \ |
| 23 | + ninja-build \ |
| 24 | + patch \ |
| 25 | + zeromq-devel |
| 26 | + |
| 27 | +# Stage 2: Build custom dependencies from source into /usr/local. |
| 28 | +# Source and build trees are discarded with this stage. |
| 29 | +FROM buildenv AS build |
| 30 | + |
| 31 | +ARG BOOST_VERSION=90 |
| 32 | +ARG FAIRCMAKEMODULES_VERSION=v1.0.0 |
| 33 | +ARG FAIRLOGGER_VERSION=v2.3.1 |
| 34 | +ARG FAIRMQ_VERSION=v1.10.1 |
| 35 | +ARG DDS_VERSION=3.18 |
| 36 | + |
| 37 | +ADD https://archives.boost.io/release/1.${BOOST_VERSION}.0/source/boost_1_${BOOST_VERSION}_0.tar.gz /boost.tar.gz |
| 38 | +RUN tar xzf /boost.tar.gz && \ |
| 39 | + cd /boost_1_${BOOST_VERSION}_0 && \ |
| 40 | + ./bootstrap.sh --prefix=/usr/local && \ |
| 41 | + ./b2 install -j$(nproc) --without-python --without-mpi |
| 42 | + |
| 43 | +ADD --keep-git-dir=true https://github.com/FairRootGroup/FairCMakeModules.git#${FAIRCMAKEMODULES_VERSION} /FairCMakeModules |
| 44 | +RUN cmake -GNinja -S FairCMakeModules -B FairCMakeModules_build -DCMAKE_INSTALL_PREFIX=/usr/local && \ |
| 45 | + cmake --build FairCMakeModules_build --target install |
| 46 | + |
| 47 | +ADD --keep-git-dir=true https://github.com/FairRootGroup/FairLogger.git#${FAIRLOGGER_VERSION} /FairLogger |
| 48 | +RUN cmake -GNinja -S FairLogger -B FairLogger_build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release && \ |
| 49 | + cmake --build FairLogger_build --target install |
| 50 | + |
| 51 | +ADD --keep-git-dir=true https://github.com/FairRootGroup/FairMQ.git#${FAIRMQ_VERSION} /FairMQ |
| 52 | +RUN cmake -GNinja -S FairMQ -B FairMQ_build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release && \ |
| 53 | + cmake --build FairMQ_build --target install |
| 54 | + |
| 55 | +ADD https://github.com/FairRootGroup/DDS.git#${DDS_VERSION} /DDS |
| 56 | +RUN echo "${DDS_VERSION}" > /DDS/version && \ |
| 57 | + cmake -GNinja -S DDS -B DDS_build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_dds-tutorials=OFF && \ |
| 58 | + cmake --build DDS_build --target wn_bin && \ |
| 59 | + cmake --build DDS_build --target install |
| 60 | + |
| 61 | +# Stage 3: Final image with ODC-specific build dependencies |
| 62 | +# and the install trees of the custom-built dependencies from stage 2. |
| 63 | +FROM buildenv AS final |
| 64 | + |
| 65 | +RUN dnf -y install clang-tools-extra \ |
| 66 | + libasan \ |
| 67 | + liblsan \ |
| 68 | + libubsan && \ |
| 69 | + dnf -y clean all |
| 70 | + |
| 71 | +COPY --from=build /usr/local /usr/local |
0 commit comments