Skip to content

Commit 2c77546

Browse files
committed
ci: consolidate Dockerfiles into single parameterized Dockerfile.fedora
1 parent 3dd4d8f commit 2c77546

7 files changed

Lines changed: 88 additions & 247 deletions

File tree

.github/workflows/docker-images.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
include:
29-
- fedora: fedora39
30-
- fedora: fedora40
31-
- fedora: fedora41
32-
- fedora: fedora42
33-
- fedora: fedora42-boost190
29+
- image: fedora39
30+
build-args: FEDORA_VERSION=39
31+
- image: fedora40
32+
build-args: FEDORA_VERSION=40
33+
- image: fedora41
34+
build-args: FEDORA_VERSION=41
35+
- image: fedora42
36+
build-args: FEDORA_VERSION=42
37+
- image: fedora42-boost190
38+
build-args: |
39+
FEDORA_VERSION=42
40+
BOOST_VERSION=90
3441
3542
steps:
3643
- name: Checkout
@@ -50,8 +57,9 @@ jobs:
5057
uses: docker/build-push-action@v6
5158
with:
5259
context: utils/ci
53-
file: utils/ci/Dockerfile.${{ matrix.fedora }}
60+
file: utils/ci/Dockerfile.fedora
61+
build-args: ${{ matrix.build-args }}
5462
push: ${{ github.event_name != 'pull_request' }}
55-
tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.fedora }}
56-
cache-from: type=registry,ref=${{ env.IMAGE_PREFIX }}:${{ matrix.fedora }}-cache
57-
cache-to: type=registry,ref=${{ env.IMAGE_PREFIX }}:${{ matrix.fedora }}-cache,mode=max
63+
tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.image }}
64+
cache-from: type=registry,ref=${{ env.IMAGE_PREFIX }}:${{ matrix.image }}-cache
65+
cache-to: type=registry,ref=${{ env.IMAGE_PREFIX }}:${{ matrix.image }}-cache,mode=max

utils/ci/Dockerfile.fedora

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

utils/ci/Dockerfile.fedora39

Lines changed: 0 additions & 46 deletions
This file was deleted.

utils/ci/Dockerfile.fedora40

Lines changed: 0 additions & 46 deletions
This file was deleted.

utils/ci/Dockerfile.fedora41

Lines changed: 0 additions & 46 deletions
This file was deleted.

utils/ci/Dockerfile.fedora42

Lines changed: 0 additions & 46 deletions
This file was deleted.

utils/ci/Dockerfile.fedora42-boost190

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)