Skip to content

Commit b7d59ae

Browse files
committed
Add packages (bison, flex, wget) needed by clio, fix EOF
1 parent 68cd7cc commit b7d59ae

File tree

3 files changed

+60
-26
lines changed

3 files changed

+60
-26
lines changed

docker/debian/Dockerfile

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ EOF
3737
# especially important when the image is built from a cached layer.
3838
RUN <<EOF
3939
pkgs=()
40+
pkgs+=(bison) # Required build tool.
4041
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
4142
pkgs+=(cmake) # Required build tool.
4243
pkgs+=(curl) # Dependency for tools requiring downloading data.
44+
pkgs+=(flex) # Required build tool.
4345
pkgs+=(git) # Required build tool.
4446
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
4547
pkgs+=(jq) # Pretty printing.
4648
pkgs+=(libc6-dev) # Required build tool.
4749
pkgs+=(ninja-build) # Required build tool.
4850
pkgs+=(pipx) # Package manager for Python applications.
51+
pkgs+=(wget) # Required build tool.
4952
apt update && apt install -y "${pkgs[@]}"
5053
EOF
5154

@@ -68,24 +71,24 @@ FROM base AS gcc
6871
COPY --from=gcc-src /usr/local/ /usr/local/
6972
COPY --from=gcc-src /etc/ld.so.conf.d/*.conf /etc/ld.so.conf.d/
7073
RUN <<EOF
71-
set -ex
72-
ldconfig -v
73-
dpkg-divert --divert /usr/bin/gcc.orig --rename /usr/bin/gcc
74-
dpkg-divert --divert /usr/bin/g++.orig --rename /usr/bin/g++
75-
dpkg-divert --divert /usr/bin/gfortran.orig --rename /usr/bin/gfortran
76-
update-alternatives --install /usr/bin/cc cc /usr/local/bin/gcc 999
77-
update-alternatives --install \
78-
/usr/bin/gcc gcc /usr/local/bin/gcc 100 \
79-
--slave /usr/bin/g++ g++ /usr/local/bin/g++ \
80-
--slave /usr/bin/gcc-ar gcc-ar /usr/local/bin/gcc-ar \
81-
--slave /usr/bin/gcc-nm gcc-nm /usr/local/bin/gcc-nm \
82-
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/local/bin/gcc-ranlib \
83-
--slave /usr/bin/gcov gcov /usr/local/bin/gcov \
84-
--slave /usr/bin/gcov-tool gcov-tool /usr/local/bin/gcov-tool \
85-
--slave /usr/bin/gcov-dump gcov-dump /usr/local/bin/gcov-dump \
86-
--slave /usr/bin/lto-dump lto-dump /usr/local/bin/lto-dump
87-
update-alternatives --auto cc
88-
update-alternatives --auto gcc
74+
set -ex
75+
ldconfig -v
76+
dpkg-divert --divert /usr/bin/gcc.orig --rename /usr/bin/gcc
77+
dpkg-divert --divert /usr/bin/g++.orig --rename /usr/bin/g++
78+
dpkg-divert --divert /usr/bin/gfortran.orig --rename /usr/bin/gfortran
79+
update-alternatives --install /usr/bin/cc cc /usr/local/bin/gcc 999
80+
update-alternatives --install \
81+
/usr/bin/gcc gcc /usr/local/bin/gcc 100 \
82+
--slave /usr/bin/g++ g++ /usr/local/bin/g++ \
83+
--slave /usr/bin/gcc-ar gcc-ar /usr/local/bin/gcc-ar \
84+
--slave /usr/bin/gcc-nm gcc-nm /usr/local/bin/gcc-nm \
85+
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/local/bin/gcc-ranlib \
86+
--slave /usr/bin/gcov gcov /usr/local/bin/gcov \
87+
--slave /usr/bin/gcov-tool gcov-tool /usr/local/bin/gcov-tool \
88+
--slave /usr/bin/gcov-dump gcov-dump /usr/local/bin/gcov-dump \
89+
--slave /usr/bin/lto-dump lto-dump /usr/local/bin/lto-dump
90+
update-alternatives --auto cc
91+
update-alternatives --auto gcc
8992
EOF
9093

9194
# Clean up unnecessary files to reduce image size.
@@ -110,13 +113,16 @@ FROM base AS clang
110113
# base image.
111114
ARG DEBIAN_VERSION
112115
ARG CLANG_VERSION
113-
RUN curl --no-progress-meter https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm.gpg && \
114-
printf "%s\n%s\n" \
115-
"deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${DEBIAN_VERSION}/ llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} main" \
116-
"deb-src [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${DEBIAN_VERSION}/ llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} main" \
117-
| tee /etc/apt/sources.list.d/llvm.list && \
118-
apt update && \
119-
apt install -t llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} -y --no-install-recommends clang-${CLANG_VERSION} llvm-${CLANG_VERSION}
116+
RUN <<EOF
117+
set -ex
118+
curl --no-progress-meter https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm.gpg
119+
printf "%s\n%s\n" \
120+
"deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${DEBIAN_VERSION}/ llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} main" \
121+
"deb-src [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${DEBIAN_VERSION}/ llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} main" \
122+
| tee /etc/apt/sources.list.d/llvm.list
123+
apt update
124+
apt install -t llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} -y --no-install-recommends clang-${CLANG_VERSION} llvm-${CLANG_VERSION}
125+
EOF
120126
ENV CC=/usr/bin/clang-${CLANG_VERSION}
121127
ENV CXX=/usr/bin/clang++-${CLANG_VERSION}
122128

@@ -133,6 +139,7 @@ RUN conan profile detect
133139
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
134140
# To ensure compatibility with a range of Clang compilers, we must add extra
135141
# flags that apply to certain versions of Clang.
142+
# TODO: Move this into the rippled repository as a custom Conan profile.
136143
RUN <<EOF
137144
if [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
138145
cat >>~/.conan2/profiles/default <<EOT

docker/rhel/Dockerfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# ====================== GCC IMAGE ======================
1+
# We want to use the subscription-free Red Hat UBI images, but those only
2+
# provide a subset of the packages available in the full Red Hat Enterprise
3+
# Linux (RHEL) distribution. To get some of the packages we need, we use those
4+
# provided by the Rocky Linux project, which is a community-developed operating
5+
# system designed to be a 100% bug-for-bug compatible alternative to RHEL.
26
ARG RHEL_VERSION
7+
FROM rockylinux/rockylinux:${RHEL_VERSION%.*} AS rocky
8+
RUN dnf -y install bison flex
9+
10+
# ====================== BASE IMAGE ======================
311
FROM registry.redhat.io/ubi${RHEL_VERSION%.*}/s2i-base:${RHEL_VERSION} AS base
412

513
# Change to the root user to install packages.
@@ -13,6 +21,9 @@ ENTRYPOINT ["/bin/bash"]
1321
ARG GITHUB_REPO
1422
LABEL org.opencontainers.image.source=https://github.com/${GITHUB_REPO}
1523

24+
# Update the packages installed on the system.
25+
RUN dnf -y update-minimal --security --sec-severity=Important --sec-severity=Critical
26+
1627
# Install tools that are shared by all stages.
1728
RUN <<EOF
1829
pkgs=()
@@ -25,9 +36,14 @@ pkgs+=(libstdc++-static) # Required to statically link libraries into rippled.
2536
pkgs+=(ninja-build) # Required build tool.
2637
pkgs+=(perl-FindBin) # Required to compile OpenSSL.
2738
pkgs+=(python3-pip) # Package manager for Python applications.
39+
pkgs+=(wget) # Required build tool.
2840
dnf install -y --setopt=tsflags=nodocs "${pkgs[@]}"
2941
EOF
3042

43+
# Copy Bison and Flex from the Rocky Linux image.
44+
COPY --from=rocky /usr/bin/bison /usr/bin/bison
45+
COPY --from=rocky /usr/bin/flex /usr/bin/flex
46+
3147
# Install Conan.
3248
ARG CONAN_VERSION
3349
RUN pip install conan==${CONAN_VERSION}
@@ -43,6 +59,9 @@ FROM base AS gcc
4359
ARG GCC_VERSION
4460
RUN dnf install -y --setopt=tsflags=nodocs gcc-toolset-${GCC_VERSION}-gcc gcc-toolset-${GCC_VERSION}-gcc-c++
4561

62+
# Clean up unnecessary files to reduce image size.
63+
RUN dnf -y clean all
64+
4665
# Switch to the non-root user.
4766
USER ${NONROOT_USER}
4867
WORKDIR /home/${NONROOT_USER}
@@ -67,6 +86,9 @@ RUN dnf install -y --setopt=tsflags=nodocs clang llvm
6786
ENV CC=/usr/bin/clang
6887
ENV CXX=/usr/bin/clang++
6988

89+
# Clean up unnecessary files to reduce image size.
90+
RUN dnf -y clean all
91+
7092
# Switch to the non-root user.
7193
USER ${NONROOT_USER}
7294
WORKDIR /home/${NONROOT_USER}
@@ -81,6 +103,7 @@ RUN conan profile detect
81103
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ${CONAN_HOME}/profiles/default
82104
# To ensure compatibility with a range of Clang compilers, we must add extra
83105
# flags that apply to certain versions of Clang.
106+
# TODO: Move this into the rippled repository as a custom Conan profile.
84107
RUN <<EOF
85108
if [[ $(clang --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
86109
cat >>${CONAN_HOME}/profiles/default <<EOT

docker/ubuntu/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ EOF
2626
# especially important when the image is built from a cached layer.
2727
RUN <<EOF
2828
pkgs=()
29+
pkgs+=(bison) # Required build tool.
2930
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
3031
pkgs+=(cmake) # Required build tool.
3132
pkgs+=(curl) # Dependency for tools requiring downloading data.
33+
pkgs+=(flex) # Required build tool.
3234
pkgs+=(git) # Required build tool.
3335
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
3436
pkgs+=(jq) # Pretty printing.
3537
pkgs+=(libc6-dev) # Required build tool.
3638
pkgs+=(ninja-build) # Required build tool.
3739
pkgs+=(pipx) # Package manager for Python applications.
40+
pkgs+=(wget) # Required build tool.
3841
apt update && apt install -y "${pkgs[@]}"
3942
EOF
4043

@@ -94,6 +97,7 @@ RUN conan profile detect
9497
RUN sed -i -e 's|^compiler\.cppstd=.*$|compiler.cppstd=20|' ~/.conan2/profiles/default
9598
# To ensure compatibility with a range of Clang compilers, we must add extra
9699
# flags that apply to certain versions of Clang.
100+
# TODO: Move this into the rippled repository as a custom Conan profile.
97101
RUN <<EOF
98102
if [[ $(clang-${CLANG_VERSION} --version | head -1 | grep -Po 'version \K[0-9]{2}') -ge 20 ]]; then
99103
cat >>~/.conan2/profiles/default <<EOT

0 commit comments

Comments
 (0)