Skip to content

Commit

Permalink
fix: Dockerfile import snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
vidbregar committed Jan 19, 2024
1 parent 3685cb5 commit d351584
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions scripts/docker-lotus-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit d351584

Please sign in to comment.