Skip to content

Commit

Permalink
add static link flag, update upstream ci.go
Browse files Browse the repository at this point in the history
  • Loading branch information
0xe3b0c4 committed Aug 5, 2022
1 parent 10d2bac commit 59a80d1
Show file tree
Hide file tree
Showing 4 changed files with 315 additions and 75 deletions.
55 changes: 49 additions & 6 deletions Dockerfile
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"]
54 changes: 49 additions & 5 deletions Dockerfile.alltools
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"]
Loading

0 comments on commit 59a80d1

Please sign in to comment.