mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
build: use scratch as runtime base image
This commit is contained in:
parent
b77a9b127c
commit
e40e25cefd
3 changed files with 9 additions and 8 deletions
|
|
@ -16,10 +16,11 @@ RUN cd /go-ethereum && go mod download
|
|||
ADD . /go-ethereum
|
||||
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
|
||||
# Pull Geth into a second stage deploy container
|
||||
FROM scratch
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
# Add certificates for HTTPS
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||
|
||||
EXPOSE 8545 8546 30303 30303/udp
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@ RUN cd /go-ethereum && go mod download
|
|||
ADD . /go-ethereum
|
||||
RUN cd /go-ethereum && go run build/ci.go install -static
|
||||
|
||||
# Pull all binaries into a second stage deploy alpine container
|
||||
FROM alpine:latest
|
||||
# Pull all binaries into a second stage deploy container
|
||||
FROM scratch
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
# Add certificates for HTTPS
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/
|
||||
|
||||
EXPOSE 8545 8546 30303 30303/udp
|
||||
|
|
|
|||
|
|
@ -154,8 +154,7 @@ docker run -d --name ethereum-node -v /Users/alice/ethereum:/root \
|
|||
|
||||
This will start `geth` in snap-sync mode with a DB memory allowance of 1GB, as the
|
||||
above command does. It will also create a persistent volume in your home directory for
|
||||
saving your blockchain as well as map the default ports. There is also an `alpine` tag
|
||||
available for a slim version of the image.
|
||||
saving your blockchain as well as map the default ports.
|
||||
|
||||
Do not forget `--http.addr 0.0.0.0`, if you want to access RPC from other containers
|
||||
and/or hosts. By default, `geth` binds to the local interface and RPC endpoints are not
|
||||
|
|
|
|||
Loading…
Reference in a new issue