Skip to content

Commit ddde674

Browse files
committed
Add RHEL Docker images
1 parent 2d8b899 commit ddde674

File tree

9 files changed

+349
-34
lines changed

9 files changed

+349
-34
lines changed

.github/workflows/debian.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- docker/debian/Dockerfile
88

99
env:
10-
DOCKER_REGISTRY: ghcr.io
10+
GITHUB_REGISTRY: ghcr.io
1111
DOCKER_BUILDKIT: 1
1212
BUILDKIT_PROGRESS: plain
1313
CONAN_VERSION: 2.17.0
@@ -29,13 +29,13 @@ jobs:
2929
- name: Checkout repository
3030
uses: actions/checkout@v4
3131
- name: Login to GitHub Container Registry
32-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${DOCKER_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
32+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GITHUB_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
3333
- name: Determine the Docker image name.
3434
run: |
3535
# Convert the repository name to lowercase as the organization name is
3636
# uppercase, which is not permitted by the Docker registry.
3737
DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}
38-
echo "DOCKER_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}/debian-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
38+
echo "DOCKER_IMAGE=${GITHUB_REGISTRY}/${DOCKER_REPOSITORY}/debian-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
3939
- name: Build the Docker image
4040
working-directory: docker/debian
4141
run: |
@@ -69,13 +69,13 @@ jobs:
6969
- name: Checkout repository
7070
uses: actions/checkout@v4
7171
- name: Login to GitHub Container Registry
72-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${DOCKER_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
72+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GITHUB_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
7373
- name: Determine the Docker image name.
7474
run: |
7575
# Convert the repository name to lowercase as the organization name is
7676
# uppercase, which is not permitted by the Docker registry.
7777
DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}
78-
echo "DOCKER_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}/debian-${{ matrix.version.os }}:clang${{ matrix.version.clang }}" >> $GITHUB_ENV
78+
echo "DOCKER_IMAGE=${GITHUB_REGISTRY}/${DOCKER_REPOSITORY}/debian-${{ matrix.version.os }}:clang${{ matrix.version.clang }}" >> $GITHUB_ENV
7979
- name: Build the Docker image
8080
working-directory: docker/debian
8181
run: |

.github/workflows/rhel.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: RHEL
2+
3+
on:
4+
push:
5+
paths:
6+
- .github/workflows/rhel.yml
7+
- docker/rhel/Dockerfile
8+
9+
env:
10+
GITHUB_REGISTRY: ghcr.io
11+
REDHAT_REGISTRY: registry.redhat.io
12+
DOCKER_BUILDKIT: 1
13+
BUILDKIT_PROGRESS: plain
14+
CONAN_VERSION: 2.17.0
15+
16+
jobs:
17+
# Build the Docker image for Red Hat Enterprise Linux using different versions
18+
# of GCC.
19+
gcc:
20+
runs-on: rhel-latest
21+
strategy:
22+
matrix:
23+
version:
24+
- os: 9.6
25+
gcc: 13
26+
- os: 9.6
27+
gcc: 14
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
- name: Login to GitHub Container Registry
32+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GITHUB_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
33+
- name: Determine the Docker image name.
34+
run: |
35+
# Convert the repository name to lowercase as the organization name is
36+
# uppercase, which is not permitted by the Docker registry.
37+
DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}
38+
echo "DOCKER_IMAGE=${GITHUB_REGISTRY}/${DOCKER_REPOSITORY}/rhel-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
39+
- name: Build the Docker image
40+
working-directory: docker/rhel
41+
run: |
42+
docker build . \
43+
--target gcc \
44+
--build-arg GITHUB_REPO=${GITHUB_REPOSITORY} \
45+
--build-arg RHEL_VERSION=${{ matrix.version.os }} \
46+
--build-arg GCC_VERSION=${{ matrix.version.gcc }} \
47+
--build-arg CONAN_VERSION=${{ env.CONAN_VERSION }} \
48+
--tag ${{ env.DOCKER_IMAGE }}
49+
- name: Push the Docker image
50+
run: docker push ${{ env.DOCKER_IMAGE }}
51+
52+
# Build the Docker image for Red Hat Enterprise Linux. As we use the free UBIs
53+
# we cannot select specific versions of Clang and only get what is available
54+
# in the package manager.
55+
clang:
56+
runs-on: rhel-latest
57+
strategy:
58+
matrix:
59+
version:
60+
- os: 9.6
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
- name: Login to GitHub Container Registry
65+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GITHUB_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
66+
- name: Determine the Docker image name.
67+
run: |
68+
# Convert the repository name to lowercase as the organization name is
69+
# uppercase, which is not permitted by the Docker registry.
70+
DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}
71+
echo "DOCKER_IMAGE=${GITHUB_REGISTRY}/${DOCKER_REPOSITORY}/rhel-${{ matrix.version.os }}:clang" >> $GITHUB_ENV
72+
- name: Build the Docker image
73+
working-directory: docker/rhel
74+
run: |
75+
docker build . \
76+
--target clang \
77+
--build-arg GITHUB_REPO=${GITHUB_REPOSITORY} \
78+
--build-arg RHEL_VERSION=${{ matrix.version.os }} \
79+
--build-arg CONAN_VERSION=${{ env.CONAN_VERSION }} \
80+
--tag ${{ env.DOCKER_IMAGE }}
81+
- name: Push the Docker image
82+
run: docker push ${{ env.DOCKER_IMAGE }}

.github/workflows/ubuntu.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- docker/ubuntu/Dockerfile
88

99
env:
10-
DOCKER_REGISTRY: ghcr.io
10+
GITHUB_REGISTRY: ghcr.io
1111
DOCKER_BUILDKIT: 1
1212
BUILDKIT_PROGRESS: plain
1313
CONAN_VERSION: 2.17.0
@@ -30,13 +30,13 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v4
3232
- name: Login to GitHub Container Registry
33-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${DOCKER_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
33+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GITHUB_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
3434
- name: Determine the Docker image name.
3535
run: |
3636
# Convert the repository name to lowercase as the organization name is
3737
# uppercase, which is not permitted by the Docker registry.
3838
DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}
39-
echo "DOCKER_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}/ubuntu-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
39+
echo "DOCKER_IMAGE=${GITHUB_REGISTRY}/${DOCKER_REPOSITORY}/ubuntu-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
4040
- name: Build the Docker image
4141
working-directory: docker/ubuntu
4242
run: |
@@ -69,13 +69,13 @@ jobs:
6969
- name: Checkout repository
7070
uses: actions/checkout@v4
7171
- name: Login to GitHub Container Registry
72-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${DOCKER_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
72+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GITHUB_REGISTRY} -u ${{ github.repository_owner }} --password-stdin
7373
- name: Determine the Docker image name.
7474
run: |
7575
# Convert the repository name to lowercase as the organization name is
7676
# uppercase, which is not permitted by the Docker registry.
7777
DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}
78-
echo "DOCKER_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}/ubuntu-${{ matrix.version.os }}:clang${{ matrix.version.clang }}" >> $GITHUB_ENV
78+
echo "DOCKER_IMAGE=${GITHUB_REGISTRY}/${DOCKER_REPOSITORY}/ubuntu-${{ matrix.version.os }}:clang${{ matrix.version.clang }}" >> $GITHUB_ENV
7979
- name: Build the Docker image
8080
working-directory: docker/ubuntu
8181
run: |

docker/debian/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ FROM gcc:${GCC_VERSION}-${DEBIAN_VERSION} AS gcc-src
1111
# ====================== BASE IMAGE ======================
1212
FROM debian:${DEBIAN_VERSION} AS base
1313

14-
# Use Bash as the default shell for RUN commands.
14+
# Use Bash as the default shell for RUN commands and as the entrypoint.
1515
SHELL ["/bin/bash", "-c"]
16+
ENTRYPOINT ["/bin/bash"]
1617

1718
# Associate the image with the repository.
1819
ARG GITHUB_REPO=XRPLF/ci
@@ -118,3 +119,13 @@ WORKDIR /home/${NONROOT_USER}
118119

119120
# Create a default Conan profile.
120121
RUN conan profile detect
122+
# To ensure compatibility with a range of Clang compilers, we must add an extra
123+
# flag that applies to Clang 19 and later versions.
124+
RUN <<EOF
125+
if [[ "${CLANG_VERSION}" -ge 19 ]]; then
126+
cat >>${CONAN_HOME}/profiles/default <<EOT
127+
[conf]
128+
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
129+
EOT
130+
fi
131+
EOF

docker/debian/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ Although the images will be built by a CI pipeline in this repository, if
77
necessary a maintainer can build them manually by following the instructions
88
below.
99

10-
### Logging into the Docker registry
10+
### Logging into the GitHub registry
1111

12-
To be able to push to GitHub a personal access token is needed, see instructions
13-
[here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic).
12+
To be able to push a Docker image to the GitHub registry, a personal access
13+
token is needed, see instructions [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic).
1414
In summary, if you do not have a suitable personal access token, generate one
1515
[here](https://github.com/settings/tokens/new?scopes=write:packages).
1616

1717
```shell
18-
DOCKER_REGISTRY=ghcr.io
18+
GITHUB_REGISTRY=ghcr.io
1919
GITHUB_USER=<your-github-username>
2020
GITHUB_TOKEN=<your-github-personal-access-token>
2121
echo ${GITHUB_TOKEN} | \
22-
docker login ${DOCKER_REGISTRY} -u "${GITHUB_USER}" --password-stdin
22+
docker login ${GITHUB_REGISTRY} -u "${GITHUB_USER}" --password-stdin
2323
```
2424

2525
### Building and pushing the Docker image
@@ -48,10 +48,10 @@ DOCKER_BUILDKIT=1 docker build . \
4848
--build-arg DEBIAN_VERSION=${DEBIAN_VERSION} \
4949
--build-arg GCC_VERSION=${GCC_VERSION} \
5050
--build-arg CONAN_VERSION=${CONAN_VERSION} \
51-
--tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE} \
51+
--tag ${GITHUB_REGISTRY}/${DOCKER_IMAGE} \
5252
--platform linux/amd64
5353

54-
docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}
54+
docker push ${GITHUB_REGISTRY}/${DOCKER_IMAGE}
5555
```
5656

5757
#### Building the Docker image for Clang.
@@ -71,10 +71,10 @@ DOCKER_BUILDKIT=1 docker build . \
7171
--build-arg DEBIAN_VERSION=${DEBIAN_VERSION} \
7272
--build-arg CLANG_VERSION=${CLANG_VERSION} \
7373
--build-arg CONAN_VERSION=${CONAN_VERSION} \
74-
--tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE} \
74+
--tag ${GITHUB_REGISTRY}/${DOCKER_IMAGE} \
7575
--platform linux/amd64
7676

77-
docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}
77+
docker push ${GITHUB_REGISTRY}/${DOCKER_IMAGE}
7878
```
7979

8080
#### Running the Docker image
@@ -84,7 +84,7 @@ can do so with the following command:
8484

8585
```shell
8686
CODEBASE=<path to the rippled repository>
87-
docker run --rm -it -v ${CODEBASE}:/rippled ${DOCKER_REGISTRY}/${DOCKER_IMAGE}
87+
docker run --rm -it -v ${CODEBASE}:/rippled ${GITHUB_REGISTRY}/${DOCKER_IMAGE}
8888
```
8989

9090
Once inside the container you can run the following commands to build `rippled`:
@@ -103,7 +103,7 @@ cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
103103
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} ..
104104
# Build and test rippled. Setting the parallelism too high, e.g. to $(nproc),
105105
# can result in an error like "gmake[2]: ...... Killed".
106-
PARALLELISM=4
106+
PARALLELISM=2
107107
cmake --build . -j ${PARALLELISM}
108108
./rippled --unittest --unittest-jobs ${PARALLELISM}
109109
```

docker/rhel/Dockerfile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# ====================== GCC IMAGE ======================
2+
ARG RHEL_VERSION=9.6
3+
FROM registry.redhat.io/ubi${RHEL_VERSION%.*}/s2i-base:${RHEL_VERSION} AS base
4+
5+
# Change to the root user to install packages.
6+
USER root
7+
8+
# Use Bash as the default shell for RUN commands and as the entrypoint.
9+
SHELL ["/bin/bash", "-c"]
10+
ENTRYPOINT ["/bin/bash"]
11+
12+
# Associate the image with the repository.
13+
ARG GITHUB_REPO=XRPLF/ci
14+
LABEL org.opencontainers.image.source=https://github.com/${GITHUB_REPO}
15+
16+
# Install tools that are shared by all stages.
17+
RUN <<EOF
18+
pkgs=()
19+
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
20+
pkgs+=(cmake) # Required build tool.
21+
pkgs+=(jq) # Pretty printing.
22+
pkgs+=(libstdc++-static) # Required to statically link libraries into rippled.
23+
pkgs+=(ninja-build) # Required build tool.
24+
pkgs+=(perl-FindBin) # Required to compile OpenSSL.
25+
pkgs+=(python3-pip) # Package manager for Python applications.
26+
dnf install -y --setopt=tsflags=nodocs "${pkgs[@]}"
27+
EOF
28+
29+
# Install Conan.
30+
ARG CONAN_VERSION=2.17.0
31+
RUN pip install conan==${CONAN_VERSION}
32+
33+
# Create the user to switch to, once all packages have been installed.
34+
ARG NONROOT_USER=ci
35+
RUN useradd -ms /bin/bash ${NONROOT_USER}
36+
37+
# ====================== GCC IMAGE ======================
38+
FROM base AS gcc
39+
40+
# Install GCC.
41+
ARG GCC_VERSION=14
42+
RUN dnf install -y --setopt=tsflags=nodocs gcc-toolset-${GCC_VERSION}-gcc gcc-toolset-${GCC_VERSION}-gcc-c++
43+
44+
# Switch to the non-root user.
45+
USER ${NONROOT_USER}
46+
WORKDIR /home/${NONROOT_USER}
47+
48+
# Fix the Conan user home directory as it otherwise will point to the
49+
# /opt/app-root/src/.conan2 directory.
50+
ENV CONAN_HOME=/home/${NONROOT_USER}/.conan2
51+
52+
# Create a default Conan profile.
53+
RUN conan profile detect
54+
55+
# ===================== CLANG IMAGE =====================
56+
FROM base AS clang
57+
58+
# Install Clang. Note that in the RHEL UBIs, we cannot choose the Clang version
59+
# to install and we get what is available.
60+
RUN dnf install -y --setopt=tsflags=nodocs clang llvm
61+
ENV CC=/usr/bin/clang
62+
ENV CXX=/usr/bin/clang++
63+
64+
# Switch to the non-root user.
65+
USER ${NONROOT_USER}
66+
WORKDIR /home/${NONROOT_USER}
67+
68+
# Fix the Conan user home directory as it otherwise will point to the
69+
# /opt/app-root/src/.conan2 directory.
70+
ENV CONAN_HOME=/home/${NONROOT_USER}/.conan2
71+
72+
# Create a default Conan profile.
73+
RUN conan profile detect
74+
# To ensure compatibility with a range of Clang compilers, we must add an extra
75+
# flag that applies to Clang 19 and later versions.
76+
RUN <<EOF
77+
if [[ $(clang --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 19 ]]; then
78+
cat >>${CONAN_HOME}/profiles/default <<EOT
79+
[conf]
80+
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
81+
EOT
82+
fi
83+
EOF
84+
85+
USER root

0 commit comments

Comments
 (0)