besu-hpc/Dockerfile
Sofiane Gerhardt b4a4842338 First commit
2024-10-21 10:50:05 +02:00

62 lines
2.1 KiB
Docker

# This dockerfile generates an s390x docker image for HPC containing an Hyperledger/Besu installation.
# Build arguments:
# VERSION: Required. Used to label the image.
ARG VERSION
########################### Stage 0 ########################
# Use distro from amd64 image
FROM --platform=amd64 hyperledger/besu:$VERSION as linux_stage_0
########################### Stage 1 ########################
# Build the actual release docker image
FROM ibm-semeru-runtimes:open-17-jre
ARG UID=1000
ARG GID=1000
ARG BESU_HOME=/opt/besu
RUN apt-get update && \
apt-get install --no-install-recommends -q --assume-yes libjemalloc-dev=5.* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -g $GID besu && \
adduser --uid $UID --gid $GID --disabled-password --gecos "" --home $BESU_HOME besu && \
chown $UID:$GID /opt/besu
COPY --from=linux_stage_0 --chown=$UID:$GID $BESU_HOME $BESU_HOME
# Add ECS formatter for Log4j2
RUN curl -s -o $BESU_HOME/lib/log4j2-ecs-layout-1.3.0.jar https://repo1.maven.org/maven2/co/elastic/logging/log4j2-ecs-layout/1.3.0/log4j2-ecs-layout-1.3.0.jar && \
curl -s -o $BESU_HOME/lib/ecs-logging-core-1.3.0.jar https://repo1.maven.org/maven2/co/elastic/logging/ecs-logging-core/1.3.0/ecs-logging-core-1.3.0.jar
RUN sed -i 's|\(^CLASSPATH=.*$\)|\1:$APP_HOME/lib/log4j2-ecs-layout-1.3.0.jar:$APP_HOME/lib/ecs-logging-core-1.3.0.jar|g' $BESU_HOME/bin/besu
COPY --chown=$UID:$GID log4j2.xml $BESU_HOME/
# Add entrypoint for HPC
COPY --chown=$UID:$GID entrypoint.sh /usr/local/bin/entrypoint.sh
# Expose services ports
# 8545 HTTP JSON-RPC
# 8546 WS JSON-RPC
# 8547 HTTP GraphQL
# 8550 HTTP ENGINE JSON-RPC
# 8551 WS ENGINE JSON-RPC
# 30303 P2P
EXPOSE 8545 8546 8547 8550 8551 30303
# defaults for host interfaces
ENV BESU_RPC_HTTP_HOST 0.0.0.0
ENV BESU_RPC_WS_HOST 0.0.0.0
ENV BESU_GRAPHQL_HTTP_HOST 0.0.0.0
ENV BESU_PID_PATH "/tmp/pid"
ENV OTEL_RESOURCE_ATTRIBUTES="service.name=besu,service.version=$VERSION"
ENV PATH="$BESU_HOME/bin:${PATH}"
USER besu
WORKDIR $BESU_HOME
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
HEALTHCHECK --start-period=5s --interval=5s --timeout=1s --retries=10 CMD bash -c "[ -f /tmp/pid ]"