forked from eth-educators/eth-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.binary
82 lines (63 loc) · 2.18 KB
/
Dockerfile.binary
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ARG DOCKER_TAG
ARG DOCKER_VC_TAG
ARG DOCKER_REPO
ARG DOCKER_VC_REPO
FROM ${DOCKER_REPO}:${DOCKER_TAG} as clsource
FROM debian:bookworm-slim as consensus
#Included here to avoid build-time complaints
ARG BUILD_TARGET
ARG SRC_REPO
ARG USER=prysmconsensus
ARG UID=10002
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \
ca-certificates curl bash tzdata git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
apt-get update; \
apt-get install -y gosu; \
rm -rf /var/lib/apt/lists/*; \
# verify that the binary works
gosu nobody true
# See https://stackoverflow.com/a/55757473/12429735RUN
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/bin/false" \
--no-create-home \
--uid "${UID}" \
"${USER}"
# Create data mount point with permissions
RUN mkdir -p /var/lib/prysm/ee-secret && chown -R ${USER}:${USER} /var/lib/prysm && chmod -R 700 /var/lib/prysm && chmod 777 /var/lib/prysm/ee-secret
# Cannot assume buildkit, hence no chmod
COPY --from=clsource --chown=${USER}:${USER} /app/cmd/beacon-chain/beacon-chain /usr/local/bin/
COPY --chown=${USER}:${USER} ./docker-entrypoint.sh /usr/local/bin/
# Belt and suspenders
RUN chmod -R 755 /usr/local/bin/*
USER ${USER}
ENTRYPOINT ["beacon-chain"]
FROM ${DOCKER_VC_REPO}:${DOCKER_VC_TAG} as vcsource
FROM consensus as validator
ARG USER=prysmvalidator
ARG UID=10000
USER root
# See https://stackoverflow.com/a/55757473/12429735RUN
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/bin/false" \
--no-create-home \
--uid "${UID}" \
"${USER}"
# Create data mount point with permissions
RUN mkdir -p /var/lib/prysm && chown ${USER}:${USER} /var/lib/prysm && chmod 700 /var/lib/prysm
# Cannot assume buildkit, hence no chmod
COPY --from=vcsource --chown=${USER}:${USER} /app/cmd/validator/validator /usr/local/bin/
COPY --chown=${USER}:${USER} ./create-wallet.sh /usr/local/bin/
COPY --chown=${USER}:${USER} ./docker-entrypoint-vc.sh /usr/local/bin/
# Belt and suspenders
RUN chmod -R 755 /usr/local/bin/*
USER ${USER}
ENTRYPOINT ["validator"]