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
66ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
77
88RUN <<-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
2616EOF
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
3423RUN <<-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
4127EOF
4228
4329RUN git clone --single-branch --branch "${VERSION}" https://github.com/ripple/rippled.git /opt/ripple
@@ -46,46 +32,61 @@ WORKDIR /opt/ripple
4632
4733ENV 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+
4941RUN <<-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
5847EOF
5948
6049RUN <<-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
6459EOF
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-
7261RUN <<-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./ ..
8072EOF
8173
8274RUN <<-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
8580EOF
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" ]
0 commit comments