Skip to content

Commit 7baa4b5

Browse files
Switch Rippled image to rootless and distroless, update to 2.5.0
1 parent 5526d47 commit 7baa4b5

File tree

7 files changed

+364
-62
lines changed

7 files changed

+364
-62
lines changed

docker-compose-testnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
- ./config-testnet/dogecoin/dogecoin.conf:/opt/dogecoin/.dogecoin/dogecoin.conf
3737

3838
rippled:
39-
image: flarefoundation/rippled:2.4.0
39+
image: flarefoundation/rippled:2.5.0
4040
restart: on-failure:3
4141
environment:
4242
- TZ=Europe/London

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333
- ./config/dogecoin/dogecoin.conf:/opt/dogecoin/.dogecoin/dogecoin.conf
3434

3535
rippled:
36-
image: flarefoundation/rippled:2.4.0
36+
image: flarefoundation/rippled:2.5.0
3737
restart: on-failure:3
3838
environment:
3939
- TZ=Europe/London

images/rippled/Dockerfile

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
# syntax=docker/dockerfile:1.3-labs
2-
FROM ubuntu:24.04 as build
2+
FROM debian:12@sha256:b6507e340c43553136f5078284c8c68d86ec8262b1724dde73c325e8d3dcdeba as build
33

4-
ARG VERSION=2.4.0
4+
ARG VERSION=2.5.0
55

66
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
77

88
RUN <<-EOF
9-
apt-get -y update && \
10-
apt-get -y install \
11-
git \
12-
build-essential \
13-
cmake \
14-
gcc \
15-
g++ \
16-
protobuf-compiler \
17-
libprotobuf-dev \
18-
flex \
19-
bison \
20-
libssl-dev \
21-
libboost-all-dev \
22-
pkg-config \
23-
python3-pip \
24-
python3.12-dev \
25-
python3.12-venv
9+
set -e
10+
apt-get -y update && apt-get -y install \
11+
python3-venv \
12+
curl \
13+
git \
14+
build-essential \
15+
cmake
2616
EOF
2717

28-
RUN <<-EOF
29-
python3.12 -m venv /opt/conan_env && \
30-
/opt/conan_env/bin/python -m pip install --upgrade pip setuptools && \
31-
/opt/conan_env/bin/python -m pip install "conan<2"
32-
EOF
18+
# To generate requirements.txt, run:
19+
# echo "conan" > requirements.in
20+
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
21+
COPY requirements.txt /tmp/requirements.txt
3322

3423
RUN <<-EOF
35-
echo "* soft nofile 1048576" >> /etc/security/limits.conf && \
36-
echo "* hard nofile 1048576" >> /etc/security/limits.conf && \
37-
echo "{{ ops_user }} soft nofile 1048576" >> /etc/security/limits.conf && \
38-
echo "{{ ops_user }} hard nofile 1048576" >> /etc/security/limits.conf && \
39-
cat /etc/security/limits.conf && \
40-
ulimit -Sn
24+
set -e
25+
python3 -m venv /opt/conan_env
26+
/opt/conan_env/bin/python -m pip install -r /tmp/requirements.txt --require-hashes
4127
EOF
4228

4329
RUN git clone --single-branch --branch "${VERSION}" https://github.com/ripple/rippled.git /opt/ripple
@@ -46,46 +32,61 @@ WORKDIR /opt/ripple
4632

4733
ENV PATH="/opt/conan_env/bin:$PATH"
4834

35+
# New and improved build process, but is not in latest (2.5.0) release yet
36+
# Move from copying the default profile to using one in
37+
# "/opt/ripple/conan/profiles/default" after it gets integrated
38+
# https://github.com/XRPLF/rippled/blob/develop/BUILD.md
39+
COPY conan_default conan_default
40+
4941
RUN <<-EOF
50-
git config --global http.postBuffer 1048576000 && \
51-
conan profile new default --detect && \
52-
conan profile update settings.compiler.cppstd=20 default && \
53-
conan export external/snappy snappy/1.1.10@ && \
54-
mkdir cmake_build && \
55-
cd cmake_build && \
56-
conan install .. --output-folder . --build missing --settings build_type=Release && \
57-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_INSTALL_PREFIX=/opt/ripple/build -Dstatic=OFF -Dxrpld=ON -Dtests=ON -B./ ..
42+
set -e
43+
git config --global http.postBuffer 1048576000
44+
conan config install conan_default -tf $(conan config home)/profiles
45+
conan remote add --index 0 xrplf "https://conan.ripplex.io"
46+
mkdir cmake_build
5847
EOF
5948

6049
RUN <<-EOF
61-
cd cmake_build && \
62-
cmake --build . --target install -- -j 8 && \
63-
./rippled --unittest
50+
set -e
51+
cd cmake_build
52+
conan install \
53+
.. \
54+
--profile:host=conan_default \
55+
--profile:build=conan_default \
56+
--output-folder . \
57+
--build missing \
58+
--settings build_type=Release
6459
EOF
6560

66-
FROM ubuntu:24.04
67-
COPY --from=build /opt/ripple/build /opt/ripple/
68-
69-
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
70-
ENV PATH="/opt/ripple/bin:${PATH}"
71-
7261
RUN <<-EOF
73-
apt-get -y update && \
74-
apt-get -y install \
75-
libboost-all-dev \
76-
net-tools \
77-
curl \
78-
jq \
79-
netcat-openbsd
62+
set -e
63+
cd cmake_build
64+
cmake \
65+
-DCMAKE_BUILD_TYPE=Release \
66+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
67+
-DCMAKE_INSTALL_PREFIX=/opt/ripple/build \
68+
-Dstatic=ON \
69+
-Dxrpld=ON \
70+
-Dtests=OFF \
71+
-B./ ..
8072
EOF
8173

8274
RUN <<-EOF
83-
mkdir -p /opt/ripple/.ripple/db && \
84-
chmod 755 /opt/ripple/.ripple/db
75+
set -e
76+
cd cmake_build
77+
cmake --build . --target install -- -j 8
78+
find /opt/ripple/build/bin -type f -executable -exec strip -s {} + 2>/dev/null || true
79+
mkdir -p /opt/ripple/.ripple/db
8580
EOF
8681

87-
COPY ./rippled.conf /opt/ripple/.ripple/rippled.conf
88-
COPY ./validators.txt /opt/ripple/.ripple/validators.txt
82+
COPY rippled.conf validators.txt /opt/ripple/.ripple/
83+
84+
FROM gcr.io/distroless/base-debian12:nonroot@sha256:dca858878977f01b80685240ca2cd9c1bb38958e2ab6f4ed5698c0ea23307143 as final
85+
86+
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
87+
88+
COPY --from=build --chown=65532:65532 /opt/ripple/build/bin/ /opt/ripple/bin/
89+
COPY --from=build --chown=65532:65532 /opt/ripple/.ripple/ /opt/ripple/.ripple/
8990

9091
# https://xrpl.org/commandline-usage.html
91-
ENTRYPOINT ["rippled", "--conf=/opt/ripple/.ripple/rippled.conf", "--fg"]
92+
ENTRYPOINT ["/opt/ripple/bin/rippled", "--conf=/opt/ripple/.ripple/rippled.conf", "--fg"]

images/rippled/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
docker build --progress plain -t flarefoundation/rippled:2.4.0 .
1+
docker build -t flarefoundation/rippled:2.5.0 .

images/rippled/conan_default

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% set os = detect_api.detect_os() %}
2+
{% set arch = detect_api.detect_arch() %}
3+
{% set compiler, version, compiler_exe = detect_api.detect_default_compiler() %}
4+
{% set compiler_version = version %}
5+
{% if os == "Linux" %}
6+
{% set compiler_version = detect_api.default_compiler_version(compiler, version) %}
7+
{% endif %}
8+
9+
[settings]
10+
os={{ os }}
11+
arch={{ arch }}
12+
build_type=Debug
13+
compiler={{compiler}}
14+
compiler.version={{ compiler_version }}
15+
compiler.cppstd=20
16+
{% if os == "Windows" %}
17+
compiler.runtime=static
18+
{% else %}
19+
compiler.libcxx={{detect_api.detect_libcxx(compiler, version, compiler_exe)}}
20+
{% endif %}
21+
22+
[conf]
23+
{% if compiler == "clang" and compiler_version >= 19 %}
24+
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
25+
{% endif %}
26+
{% if compiler == "apple-clang" and compiler_version >= 17 %}
27+
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
28+
{% endif %}
29+
{% if compiler == "gcc" and compiler_version < 13 %}
30+
tools.build:cxxflags=['-Wno-restrict']
31+
{% endif %}
32+
33+
[tool_requires]
34+
!cmake/*: cmake/[>=3 <4]

images/rippled/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
conan

0 commit comments

Comments
 (0)