Skip to content

Commit ad555ab

Browse files
committed
f
1 parent 0382cd4 commit ad555ab

File tree

3 files changed

+70
-31
lines changed

3 files changed

+70
-31
lines changed

docker/debian/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ apt update
5050
apt install -y "${pkgs[@]}"
5151
EOF
5252

53-
# Install Conan && gcovr
53+
# Install Conan && gcovr.
5454
ARG CONAN_VERSION=2.18.0
5555
ARG GCOVR_VERSION=8.2
5656
ENV PIPX_HOME=/opt/pipx \

docker/rhel/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ EOF
3737
COPY --from=rocky /usr/bin/bison /usr/bin/bison
3838
COPY --from=rocky /usr/bin/flex /usr/bin/flex
3939

40-
# Install Conan && gcovr
40+
# Install Conan && gcovr.
4141
ARG CONAN_VERSION=2.18.0
4242
ARG GCOVR_VERSION=8.2
4343
ENV PIPX_HOME=/opt/pipx \

docker/ubuntu/Dockerfile

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
# ====================== BASE IMAGE ======================
2-
ARG UBUNTU_VERSION=jammy
2+
ARG UBUNTU_VERSION
33
FROM ubuntu:${UBUNTU_VERSION} AS base
44

5-
# Use Bash as the default shell for RUN commands.
5+
# Use Bash as the default shell for RUN commands and as the entrypoint.
66
SHELL ["/bin/bash", "-c"]
7-
8-
# Associate the image with the repository.
9-
ARG GITHUB_REPO=XRPLF/ci
10-
LABEL org.opencontainers.image.source=https://github.com/${GITHUB_REPO}
7+
ENTRYPOINT ["/bin/bash"]
118

129
# Ensure any packages installed directly or indirectly via dpkg do not require
1310
# manual interaction.
1411
ARG DEBIAN_FRONTEND=noninteractive
15-
RUN apt update && apt upgrade -y
16-
RUN set -ex ;\
17-
ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime ;\
18-
apt install -y tzdata ;\
19-
dpkg-reconfigure --frontend noninteractive tzdata
12+
RUN <<EOF
13+
set -ex
14+
ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
15+
apt update
16+
apt upgrade -y
17+
apt install -y tzdata
18+
dpkg-reconfigure --frontend noninteractive tzdata
19+
EOF
2020

21-
# Install tools that are shared by all stages.
21+
# Install tools that are shared by all stages. Run `apt update` again before
22+
# installing the packages to ensure the package lists are up-to-date, which is
23+
# especially important when the image is built from a cached layer.
2224
RUN <<EOF
23-
pkgs=()
24-
pkgs+=(build-essential) # Required build tools.
25-
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
26-
pkgs+=(cmake) # Required build tool.
27-
pkgs+=(curl) # Dependency for tools requiring downloading data.
28-
pkgs+=(file) # Required packaging tool.
29-
pkgs+=(git) # Required build tool.
30-
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
31-
pkgs+=(jq) # Pretty printing.
32-
pkgs+=(ninja-build) # Required build tool.
33-
pkgs+=(pipx) # Package manager for Python applications.
34-
apt install -y "${pkgs[@]}"
25+
pkgs=()
26+
pkgs+=(bison) # Required build tool.
27+
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
28+
pkgs+=(cmake) # Required build tool.
29+
pkgs+=(curl) # Dependency for tools requiring downloading data.
30+
pkgs+=(flex) # Required build tool.
31+
pkgs+=(git) # Required build tool.
32+
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
33+
pkgs+=(jq) # Pretty printing.
34+
pkgs+=(libc6-dev) # Required build tool.
35+
pkgs+=(ninja-build) # Required build tool.
36+
pkgs+=(pipx) # Package manager for Python applications.
37+
pkgs+=(wget) # Required build tool.
38+
apt update
39+
apt install -y "${pkgs[@]}"
3540
EOF
3641

37-
# Install Conan && gcovr
42+
# Install Conan && gcovr.
3843
ARG CONAN_VERSION=2.18.0
3944
ARG GCOVR_VERSION=8.2
4045
ENV PIPX_HOME=/opt/pipx \
@@ -44,17 +49,17 @@ RUN pipx install conan==${CONAN_VERSION} && \
4449
pipx install gcovr==${GCOVR_VERSION}
4550

4651
# Create the user to switch to, once all packages have been installed.
47-
ARG NONROOT_USER=ci
52+
ARG NONROOT_USER
4853
RUN useradd -ms /bin/bash ${NONROOT_USER}
4954

5055
# ====================== GCC IMAGE ======================
5156
FROM base AS gcc
5257

5358
# Install GCC.
54-
ARG GCC_VERSION=12
59+
ARG GCC_VERSION
5560
RUN apt install -y gcc-${GCC_VERSION} g++-${GCC_VERSION}
5661
ENV CC=/usr/bin/gcc-${GCC_VERSION}
57-
ENV CXX=/usr/bin/gcc-${GCC_VERSION}
62+
ENV CXX=/usr/bin/g++-${GCC_VERSION}
5863

5964
# Clean up unnecessary files to reduce image size.
6065
RUN rm -rf /var/lib/apt/lists/* && apt clean
@@ -65,12 +70,23 @@ WORKDIR /home/${NONROOT_USER}
6570

6671
# Create a default Conan profile.
6772
RUN conan profile detect
73+
# Fix the C++ dialect.
74+
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
75+
# Explicitly set the compiler flags.
76+
RUN <<EOF
77+
cat >>~/.conan2/profiles/default <<EOT
78+
[conf]
79+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
80+
EOT
81+
EOF
82+
# Print the Conan profile to verify the configuration.
83+
RUN conan profile show
6884

6985
# ===================== CLANG IMAGE =====================
7086
FROM base AS clang
7187

7288
# Install Clang.
73-
ARG CLANG_VERSION=16
89+
ARG CLANG_VERSION
7490
RUN apt install -y clang-${CLANG_VERSION} llvm-${CLANG_VERSION}
7591
ENV CC=/usr/bin/clang-${CLANG_VERSION}
7692
ENV CXX=/usr/bin/clang++-${CLANG_VERSION}
@@ -84,3 +100,26 @@ WORKDIR /home/${NONROOT_USER}
84100

85101
# Create a default Conan profile.
86102
RUN conan profile detect
103+
# Fix the C++ dialect.
104+
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
105+
# Explicitly set the compiler flags. To ensure compatibility with a range of
106+
# Clang compilers, we must also add extra flags that apply to certain versions
107+
# of Clang.
108+
# TODO: Move extra flags into the rippled repository as a custom Conan profile.
109+
RUN <<EOF
110+
cat >>~/.conan2/profiles/default <<EOT
111+
[conf]
112+
tools.build:compiler_executables={"c": "${CC}", "cpp": "${CXX}"}
113+
EOT
114+
if [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
115+
cat >>~/.conan2/profiles/default <<EOT
116+
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw', '-Wno-deprecated-declarations']
117+
EOT
118+
elif [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -eq 19 ]]; then
119+
cat >>~/.conan2/profiles/default <<EOT
120+
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
121+
EOT
122+
fi
123+
EOF
124+
# Print the Conan profile to verify the configuration.
125+
RUN conan profile show

0 commit comments

Comments
 (0)