1+ # syntax=docker/dockerfile:1
2+
3+ # Stage: Use Eclipse Temurin JRE
4+ FROM eclipse-temurin:21-jre AS java-base
5+
6+ # Stage: Final Besu image
17FROM ubuntu:24.04
28ARG VERSION="dev"
39ENV NO_PROXY_CACHE="-o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true -o Acquire::http::Pipeline-Depth=0"
@@ -6,18 +12,20 @@ ENV NO_PROXY_CACHE="-o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true
612RUN apt-get update $NO_PROXY_CACHE && \
713 # $NO_PROXY_CACHE must not be used here or otherwise will trigger a hadolint error
814 apt-get -o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true -o Acquire::http::Pipeline-Depth=0 \
9- --no-install-recommends -q --assume-yes install openjdk-21-jre-headless=21* libjemalloc-dev=5.* adduser=3* && \
15+ --no-install-recommends -q --assume-yes install libjemalloc-dev=5.* && \
1016 # Clean apt cache
1117 apt-get clean && \
1218 rm -rf /var/cache/apt/archives/* /var/cache/apt/archives/partial/* && \
1319 rm -rf /var/lib/apt/lists/* && \
1420 # Starting from version 23.10, Ubuntu comes with an "ubuntu" user with uid 1000. We need 1000 for besu.
1521 userdel ubuntu 2>/dev/null || true && rm -rf /home/ubuntu && \
1622 # Ensure we use a stable UID for besu, as file permissions are tied to UIDs.
17- adduser --uid 1000 --disabled-password --gecos "" --home /opt/besu besu && \
18- chown besu:besu /opt/besu && \
23+ useradd --uid 1000 --create-home --home-dir /opt/besu --shell /bin/bash --user-group --skel /etc/skel besu && \
1924 chmod 0755 /opt/besu
2025
26+ # Copy JRE from the java-base stage
27+ COPY --from=java-base /opt/java/openjdk /opt/java/openjdk
28+
2129ARG BESU_USER=besu
2230USER ${BESU_USER}
2331WORKDIR /opt/besu
@@ -43,14 +51,13 @@ ENV PYROSCOPE_CONFIGURATION_FILE=/etc/besu/pyroscope.properties
4351EXPOSE 8545 8546 8547 8550 8551 30303
4452
4553# defaults for host interfaces
46- ENV BESU_RPC_HTTP_HOST 0.0.0.0
47- ENV BESU_RPC_WS_HOST 0.0.0.0
48- ENV BESU_GRAPHQL_HTTP_HOST 0.0.0.0
49- ENV BESU_PID_PATH "/tmp/pid"
54+ ENV BESU_RPC_HTTP_HOST= 0.0.0.0
55+ ENV BESU_RPC_WS_HOST= 0.0.0.0
56+ ENV BESU_GRAPHQL_HTTP_HOST= 0.0.0.0
57+ ENV BESU_PID_PATH= "/tmp/pid"
5058ENV OTEL_RESOURCE_ATTRIBUTES="service.name=besu,service.version=$VERSION"
51-
52- ENV OLDPATH="${PATH}"
53- ENV PATH="/opt/besu/bin:${OLDPATH}"
59+ ENV JAVA_HOME="/opt/java/openjdk"
60+ ENV PATH="/opt/besu/bin:${JAVA_HOME}/bin:${PATH}"
5461
5562# The entry script just sets permissions as needed based on besu config
5663# and is replaced by the besu process running as besu user.
0 commit comments