docker: add an entrypoint wrapper and 6K block dump to import

Make privnet the default for docker setups along the way and use alpine as the
base image because we now need to have sh and gzip. Fix #524.
This commit is contained in:
Roman Khimov 2019-11-29 13:36:05 +03:00
parent 969bfebe80
commit 2dfeb55d4c
3 changed files with 11 additions and 3 deletions

Binary file not shown.

6
.docker/privnet-entrypoint.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
if test -f /6000-privnet-blocks.acc.gz; then
gunzip /6000-privnet-blocks.acc.gz
/usr/bin/neo-go db restore -i /6000-privnet-blocks.acc
fi
/usr/bin/neo-go "$@"

View file

@ -22,7 +22,7 @@ RUN set -x \
&& go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli && go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli
# Executable image # Executable image
FROM scratch FROM alpine
ARG VERSION ARG VERSION
LABEL version=$VERSION LABEL version=$VERSION
@ -30,9 +30,11 @@ LABEL version=$VERSION
WORKDIR / WORKDIR /
COPY --from=builder /neo-go/config /config COPY --from=builder /neo-go/config /config
COPY --from=builder /neo-go/.docker/6000-privnet-blocks.acc.gz /
COPY --from=builder /neo-go/.docker/privnet-entrypoint.sh /usr/bin/privnet-entrypoint.sh
COPY --from=builder /go/bin/neo-go /usr/bin/neo-go COPY --from=builder /go/bin/neo-go /usr/bin/neo-go
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/usr/bin/neo-go"] ENTRYPOINT ["/usr/bin/privnet-entrypoint.sh"]
CMD ["node", "--config-path", "/config", "--testnet"] CMD ["node", "--config-path", "/config", "--privnet"]