forked from Asphere-xyz/bas-template-bsc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add static link flag, update upstream ci.go
- Loading branch information
Showing
4 changed files
with
315 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,59 @@ | ||
# Support setting various labels on the final image | ||
ARG COMMIT="" | ||
ARG VERSION="" | ||
ARG BUILDNUM="" | ||
|
||
# Build Geth in a stock Go builder container | ||
FROM golang:1.16-alpine as builder | ||
FROM golang:1.17-alpine as builder | ||
|
||
RUN apk add --no-cache make gcc musl-dev linux-headers git bash | ||
RUN apk add --no-cache make gcc musl-dev libc6-compat linux-headers git bash | ||
|
||
ADD . /go-ethereum | ||
RUN cd /go-ethereum && make geth | ||
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth | ||
|
||
# Pull Geth into a second stage deploy alpine container | ||
FROM alpine:latest | ||
FROM alpine:3.16 | ||
|
||
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 | ||
|
||
ENV PACKAGES ca-certificates jq \ | ||
bash bind-tools tini \ | ||
grep curl sed | ||
|
||
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 /bin/bash --no-create-home -D ${BSC_USER} \ | ||
&& addgroup ${BSC_USER} tty | ||
|
||
WORKDIR ${BSC_HOME} | ||
|
||
RUN apk add --no-cache ca-certificates curl jq tini | ||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/ | ||
|
||
COPY docker-entrypoint.sh ./ | ||
|
||
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 | ||
ENTRYPOINT ["geth"] | ||
|
||
# Add some metadata labels to help programatic image consumption | ||
ARG COMMIT="" | ||
ARG VERSION="" | ||
ARG BUILDNUM="" | ||
|
||
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM" | ||
|
||
ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,59 @@ | ||
# Support setting various labels on the final image | ||
ARG COMMIT="" | ||
ARG VERSION="" | ||
ARG BUILDNUM="" | ||
|
||
# Build Geth in a stock Go builder container | ||
FROM golang:1.16-alpine as builder | ||
FROM golang:1.17-alpine as builder | ||
|
||
RUN apk add --no-cache make gcc musl-dev linux-headers git | ||
RUN apk add --no-cache gcc musl-dev libc6-compat linux-headers git bash | ||
|
||
ADD . /go-ethereum | ||
RUN cd /go-ethereum && make all | ||
RUN cd /go-ethereum && go run build/ci.go install -static | ||
|
||
# Pull all binaries into a second stage deploy alpine container | ||
FROM alpine:latest | ||
FROM alpine:3.16 | ||
|
||
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 | ||
|
||
ENV PACKAGES ca-certificates jq \ | ||
bash bind-tools tini \ | ||
grep curl sed | ||
|
||
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 /bin/bash --no-create-home -D ${BSC_USER} \ | ||
&& addgroup ${BSC_USER} tty | ||
|
||
WORKDIR ${BSC_HOME} | ||
|
||
RUN apk add --no-cache ca-certificates | ||
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/ | ||
|
||
COPY docker-entrypoint.sh ./ | ||
|
||
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 30303 30303/udp | ||
|
||
# Add some metadata labels to help programatic image consumption | ||
ARG COMMIT="" | ||
ARG VERSION="" | ||
ARG BUILDNUM="" | ||
|
||
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM" | ||
|
||
ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"] |
Oops, something went wrong.