fix: Dockerfile non-interactive snapshot import (#11579)

This commit is contained in:
Vid Bregar 2024-01-19 16:56:12 +01:00 committed by GitHub
parent 3685cb5e12
commit e430d336b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -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 --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
COPY scripts/docker-lotus-entrypoint.sh / 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 DOCKER_LOTUS_IMPORT_SNAPSHOT ${DOCKER_LOTUS_IMPORT_SNAPSHOT}
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
ENV LOTUS_PATH /var/lib/lotus ENV LOTUS_PATH /var/lib/lotus

View File

@ -1,18 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ ! -z $DOCKER_LOTUS_IMPORT_SNAPSHOT ]; then if [ ! -z "$DOCKER_LOTUS_IMPORT_SNAPSHOT" ]; then
GATE="$LOTUS_PATH"/date_initialized GATE="$LOTUS_PATH"/date_initialized
# Don't init if already initialized. # Don't init if already initialized.
if [ ! -f "$GATE" ]; then if [ ! -f "$GATE" ]; then
echo importing minimal snapshot 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 # Block future inits
date > "$GATE" date > "$GATE"
fi fi
fi fi
# import wallet, if provided # 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" /usr/local/bin/lotus-shed keyinfo import "$DOCKER_LOTUS_IMPORT_WALLET"
fi fi