Skip to content

Commit

Permalink
Compress data dir to avoid sparse file bloating image, adding entrypo…
Browse files Browse the repository at this point in the history
…int.sh to extract data dir before launching nodeos
  • Loading branch information
poplexity committed Aug 1, 2024
1 parent f37b26f commit e053305
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ COPY contracts /app/contracts

RUN bash /app/setup_network.sh

COPY entrypoint.sh /app/entrypoint.sh

CMD ["nodeos", "--data-dir=/node/data-dir", "--config-dir=/node", "--enable-stale-production", "--genesis-json=/node/genesis.json"]
#CMD ["nodeos", "--data-dir=/node/data-dir", "--config-dir=/node", "--enable-stale-production", "--genesis-json=/node/genesis.json"]
CMD ["./entrypoint.sh"]
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -ex

cd /node

tar -xvf data-dir.tar.gz
nodeos --data-dir=/node/data-dir --config-dir=/node --enable-stale-production --genesis-json=/node/genesis.json

cd -
9 changes: 8 additions & 1 deletion setup_network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,11 @@ cd $OG_DIR
sleep 5

kill $NODEOS_PID
sleep 10
sleep 10

# Compress the data directory using the -S (sparse) flag to reduce the size of the image
# It is extracted before starting nodeos in the entrypoint.sh script
cd /node
tar -cSvzf data-dir.tar.gz ./data-dir
rm -rf data-dir
cd $OG_DIR

0 comments on commit e053305

Please sign in to comment.