Skip to content

Commit af188d0

Browse files
committed
temporarily add a nonroot variant until distroless trixie release
1 parent 47177fb commit af188d0

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# syntax=docker/dockerfile:1.3-labs
2+
FROM debian:trixie@sha256:8f6a88feef3ed01a300dafb87f208977f39dccda1fd120e878129463f7fa3b8f as build
3+
4+
ARG VERSION=2.6.2
5+
6+
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
7+
8+
RUN <<-EOF
9+
set -e
10+
apt-get -y update && apt-get -y install \
11+
python3-venv \
12+
curl \
13+
git \
14+
build-essential \
15+
cmake
16+
EOF
17+
18+
RUN <<-EOF
19+
set -e
20+
echo "conan" > /tmp/requirements.in
21+
python3 -m venv /opt/conan_env
22+
/opt/conan_env/bin/python -m pip install pip-tools
23+
/opt/conan_env/bin/pip-compile --generate-hashes --output-file=/tmp/requirements.txt /tmp/requirements.in
24+
/opt/conan_env/bin/python -m pip install -r /tmp/requirements.txt --require-hashes
25+
EOF
26+
27+
RUN git clone --single-branch --branch "${VERSION}" https://github.com/ripple/rippled.git /opt/ripple
28+
29+
WORKDIR /opt/ripple
30+
31+
ENV PATH="/opt/conan_env/bin:$PATH"
32+
33+
# https://github.com/XRPLF/rippled/blob/develop/BUILD.md
34+
RUN <<-EOF
35+
set -e
36+
git config --global http.postBuffer 1048576000
37+
conan config install /opt/ripple/conan/profiles/default -tf $(conan config home)/profiles
38+
conan remote add --index 0 xrplf "https://conan.ripplex.io"
39+
mkdir cmake_build
40+
EOF
41+
42+
RUN <<-EOF
43+
set -e
44+
cd cmake_build
45+
conan install \
46+
.. \
47+
--profile:host=default \
48+
--profile:build=default \
49+
--output-folder . \
50+
--build missing \
51+
--settings build_type=Release
52+
EOF
53+
54+
RUN <<-EOF
55+
set -e
56+
cd cmake_build
57+
cmake \
58+
-DCMAKE_BUILD_TYPE=Release \
59+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
60+
-DCMAKE_INSTALL_PREFIX=/opt/ripple/build \
61+
-Dstatic=ON \
62+
-Dxrpld=ON \
63+
-Dtests=OFF \
64+
-B./ ..
65+
EOF
66+
67+
RUN <<-EOF
68+
set -e
69+
cd cmake_build
70+
cmake --build . --target install -- -j 8
71+
find /opt/ripple/build/bin -type f -executable -exec strip -s {} + 2>/dev/null || true
72+
mkdir -p /opt/ripple/.ripple/db
73+
EOF
74+
75+
WORKDIR /opt/validator-keys-tool
76+
77+
RUN git clone --single-branch --branch "master" https://github.com/ripple/validator-keys-tool.git /opt/validator-keys-tool && \
78+
git checkout 05742108d4b7c0b7d9a97c073acd690d2c75a2b4
79+
80+
RUN <<-EOF
81+
set -e
82+
mkdir .build
83+
cd .build
84+
conan install \
85+
.. \
86+
--profile:host=default \
87+
--profile:build=default \
88+
--output-folder . \
89+
--build missing \
90+
--settings build_type=Release
91+
cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
92+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=conan_toolchain.cmake \
93+
-DCMAKE_BUILD_TYPE=Release \
94+
..
95+
EOF
96+
97+
RUN <<-EOF
98+
set -e
99+
cd .build
100+
cmake --build .
101+
EOF
102+
103+
COPY rippled.conf validators.txt /opt/ripple/.ripple/
104+
105+
FROM debian:trixie@sha256:8f6a88feef3ed01a300dafb87f208977f39dccda1fd120e878129463f7fa3b8f
106+
107+
COPY --from=build --chown=65532:65532 /opt/ripple/build/bin/ /opt/ripple/bin/
108+
COPY --from=build --chown=65532:65532 /opt/ripple/.ripple/ /opt/ripple/.ripple/
109+
110+
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
111+
ENV PATH="/opt/ripple/bin:${PATH}"
112+
113+
RUN <<-EOF
114+
apt-get -y update && \
115+
apt-get -y install \
116+
net-tools \
117+
curl \
118+
jq \
119+
netcat-openbsd \
120+
procps
121+
EOF
122+
123+
RUN <<-EOF
124+
groupadd -r -g 65532 nonroot && \
125+
useradd -r -u 65532 -g nonroot -d /opt/ripple -s /sbin/nologin nonroot
126+
EOF
127+
128+
RUN <<-EOF
129+
mkdir -p /opt/ripple/.ripple/db && \
130+
chmod 755 /opt/ripple/.ripple/db && \
131+
chown -R 65532:65532 /opt/ripple
132+
EOF
133+
134+
RUN mkdir -p /var/log/rippled && \
135+
chmod 775 /var/log/rippled && \
136+
chown 65532:65532 /var/log/rippled
137+
138+
USER 65532:65532
139+
140+
# https://xrpl.org/commandline-usage.html
141+
ENTRYPOINT ["rippled", "--conf=/opt/ripple/.ripple/rippled.conf", "--fg"]

0 commit comments

Comments
 (0)