2021-06-21 19:16:51 +03:00
|
|
|
# Support setting various labels on the final image
|
|
|
|
ARG COMMIT=""
|
|
|
|
ARG VERSION=""
|
|
|
|
ARG BUILDNUM=""
|
|
|
|
|
2017-09-05 12:16:59 +03:00
|
|
|
# Build Geth in a stock Go builder container
|
2024-01-02 14:44:39 +08:00
|
|
|
FROM golang:1.21-alpine as builder
|
2017-09-05 12:16:59 +03:00
|
|
|
|
2023-04-10 18:36:45 +08:00
|
|
|
RUN apk add --no-cache make cmake gcc musl-dev linux-headers git bash build-base libc-dev
|
2022-05-03 17:17:24 +08:00
|
|
|
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
|
|
|
COPY go.mod /go-ethereum/
|
|
|
|
COPY go.sum /go-ethereum/
|
|
|
|
RUN cd /go-ethereum && go mod download
|
2020-11-13 20:35:17 +08:00
|
|
|
|
2016-11-15 17:57:56 +00:00
|
|
|
ADD . /go-ethereum
|
2023-04-25 09:11:29 +08:00
|
|
|
|
|
|
|
# For blst
|
|
|
|
ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
|
|
|
|
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
|
2022-08-10 16:30:59 +08:00
|
|
|
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
|
2017-09-05 12:16:59 +03:00
|
|
|
|
|
|
|
# Pull Geth into a second stage deploy alpine container
|
2023-04-10 16:00:17 +08:00
|
|
|
FROM alpine:3.17
|
2022-07-20 12:07:00 +08:00
|
|
|
|
|
|
|
ARG BSC_USER=bsc
|
|
|
|
ARG BSC_USER_UID=1000
|
|
|
|
ARG BSC_USER_GID=1000
|
|
|
|
|
|
|
|
ENV BSC_HOME=/bsc
|
|
|
|
ENV HOME=${BSC_HOME}
|
|
|
|
ENV DATA_DIR=/data
|
|
|
|
|
2023-04-10 16:00:17 +08:00
|
|
|
ENV PACKAGES ca-certificates jq \
|
|
|
|
bash bind-tools tini \
|
2023-04-24 22:30:27 +08:00
|
|
|
grep curl sed gcc
|
2022-07-20 12:07:00 +08:00
|
|
|
|
|
|
|
RUN apk add --no-cache $PACKAGES \
|
|
|
|
&& rm -rf /var/cache/apk/* \
|
|
|
|
&& addgroup -g ${BSC_USER_GID} ${BSC_USER} \
|
|
|
|
&& adduser -u ${BSC_USER_UID} -G ${BSC_USER} --shell /sbin/nologin --no-create-home -D ${BSC_USER} \
|
|
|
|
&& addgroup ${BSC_USER} tty \
|
|
|
|
&& sed -i -e "s/bin\/sh/bin\/bash/" /etc/passwd
|
|
|
|
|
|
|
|
RUN echo "[ ! -z \"\$TERM\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bash/bashrc
|
|
|
|
|
|
|
|
WORKDIR ${BSC_HOME}
|
2016-11-15 17:57:56 +00:00
|
|
|
|
2017-09-05 12:16:59 +03:00
|
|
|
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
2016-11-15 17:57:56 +00:00
|
|
|
|
2022-07-20 12:07:00 +08:00
|
|
|
COPY docker-entrypoint.sh ./
|
2021-06-21 19:16:51 +03:00
|
|
|
|
2022-07-20 12:07:00 +08:00
|
|
|
RUN chmod +x docker-entrypoint.sh \
|
|
|
|
&& mkdir -p ${DATA_DIR} \
|
|
|
|
&& chown -R ${BSC_USER_UID}:${BSC_USER_GID} ${BSC_HOME} ${DATA_DIR}
|
|
|
|
|
|
|
|
VOLUME ${DATA_DIR}
|
|
|
|
|
|
|
|
USER ${BSC_USER_UID}:${BSC_USER_GID}
|
|
|
|
|
|
|
|
# rpc ws graphql
|
|
|
|
EXPOSE 8545 8546 8547 30303 30303/udp
|
2021-06-21 19:16:51 +03:00
|
|
|
|
2023-04-10 18:36:45 +08:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"]
|