From e430d336b22d8eaba31e9e3f64926b079180d89b Mon Sep 17 00:00:00 2001 From: Vid Bregar <38587571+vidbregar@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:56:12 +0100 Subject: [PATCH] fix: Dockerfile non-interactive snapshot import (#11579) --- Dockerfile | 2 +- scripts/docker-lotus-entrypoint.sh | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c9750a71f..ea26b6184 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,7 +73,7 @@ COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/ COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/ COPY scripts/docker-lotus-entrypoint.sh / -ARG DOCKER_LOTUS_IMPORT_SNAPSHOT https://snapshots.mainnet.filops.net/minimal/latest +ARG DOCKER_LOTUS_IMPORT_SNAPSHOT=https://forest-archive.chainsafe.dev/latest/mainnet/ ENV DOCKER_LOTUS_IMPORT_SNAPSHOT ${DOCKER_LOTUS_IMPORT_SNAPSHOT} ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters ENV LOTUS_PATH /var/lib/lotus diff --git a/scripts/docker-lotus-entrypoint.sh b/scripts/docker-lotus-entrypoint.sh index de1dfbcc8..342121d97 100755 --- a/scripts/docker-lotus-entrypoint.sh +++ b/scripts/docker-lotus-entrypoint.sh @@ -1,18 +1,21 @@ #!/usr/bin/env bash -if [ ! -z $DOCKER_LOTUS_IMPORT_SNAPSHOT ]; then +if [ ! -z "$DOCKER_LOTUS_IMPORT_SNAPSHOT" ]; then GATE="$LOTUS_PATH"/date_initialized # Don't init if already initialized. if [ ! -f "$GATE" ]; then echo importing minimal snapshot - /usr/local/bin/lotus daemon --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" --halt-after-import + /usr/local/bin/lotus daemon \ + --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" \ + --remove-existing-chain=false \ + --halt-after-import # Block future inits date > "$GATE" fi fi # import wallet, if provided -if [ ! -z $DOCKER_LOTUS_IMPORT_WALLET ]; then +if [ ! -z "$DOCKER_LOTUS_IMPORT_WALLET" ]; then /usr/local/bin/lotus-shed keyinfo import "$DOCKER_LOTUS_IMPORT_WALLET" fi