Skip to content

Commit

Permalink
Feature/lystopad/issue 12900 (#12957)
Browse files Browse the repository at this point in the history
See #12900 for more details.

1. Hardcode uid/gid to 1000/1000 in order to prevent potential change in
the future, once such uid or gid already exist.
It should simplify upgrade for our users.

2. Install binaries with owner/group root/root for security reasons.
  • Loading branch information
lystopad authored Dec 2, 2024
1 parent 9d2d6a8 commit 3b7dfbc
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARG RELEASE_DOCKER_BASE_IMAGE="alpine:3.20.1" \
CI_CD_MAIN_BUILDER_IMAGE="golang:1.22-bookworm" \
CI_CD_MAIN_TARGET_BASE_IMAGE="alpine:3.20.1" \
UID_ERIGON=1000 \
GID_ERIGON=1000 \
EXPOSED_PORTS="8545 \
8551 \
8546 \
Expand Down Expand Up @@ -31,6 +33,8 @@ FROM ${RELEASE_DOCKER_BASE_IMAGE} AS release

ARG USER=erigon \
GROUP=erigon \
UID_ERIGON \
GID_ERIGON \
APPLICATION \
TARGETARCH \
EXPOSED_PORTS
Expand All @@ -41,8 +45,8 @@ SHELL ["/bin/bash", "-c"]

RUN --mount=type=bind,from=temporary,source=/tmp/${APPLICATION},target=/tmp/${APPLICATION} \
echo Installing on ${TARGETOS} with variant ${TARGETVARIANT} && \
adduser --group ${GROUP} && \
adduser --system --ingroup ${GROUP} --home /home/${USER} --shell /bin/bash ${USER} && \
addgroup --gid {GID_ERIGON} ${GROUP} && \
adduser --system --uid ${UID_ERIGON} --ingroup ${GROUP} --home /home/${USER} --shell /bin/bash ${USER} && \
apt update -y && \
apt install -y --no-install-recommends ca-certificates && \
apt clean && \
Expand All @@ -53,13 +57,13 @@ RUN --mount=type=bind,from=temporary,source=/tmp/${APPLICATION},target=/tmp/${AP
echo "Done." ; \
fi && \
install -d -o ${USER} -g ${GROUP} /home/${USER}/.local /home/${USER}/.local/share /home/${USER}/.local/share/erigon && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/erigon /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/integration /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/diag /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/sentry /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/txpool /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/downloader /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/rpcdaemon /usr/local/bin/
install -o root -g root /tmp/${APPLICATION}/erigon /usr/local/bin/ && \
install -o root -g root /tmp/${APPLICATION}/integration /usr/local/bin/ && \
install -o root -g root /tmp/${APPLICATION}/diag /usr/local/bin/ && \
install -o root -g root /tmp/${APPLICATION}/sentry /usr/local/bin/ && \
install -o root -g root /tmp/${APPLICATION}/txpool /usr/local/bin/ && \
install -o root -g root /tmp/${APPLICATION}/downloader /usr/local/bin/ && \
install -o root -g root /tmp/${APPLICATION}/rpcdaemon /usr/local/bin/

VOLUME [ "/home/${USER}" ]
WORKDIR /home/${USER}
Expand Down Expand Up @@ -105,4 +109,4 @@ EXPOSE ${EXPOSED_PORTS}

ENTRYPOINT [ "/usr/local/bin/erigon" ]

### End of CI-CD : main branch docker image publishing for each new commit id
### End of CI-CD : main branch docker image publishing for each new commit id

0 comments on commit 3b7dfbc

Please sign in to comment.