Skip to content

Instantly share code, notes, and snippets.

@JorritvandenBerg
Last active February 26, 2018 05:40
Show Gist options
  • Save JorritvandenBerg/751967d9eb8754871f145751b7bd50c2 to your computer and use it in GitHub Desktop.
Save JorritvandenBerg/751967d9eb8754871f145751b7bd50c2 to your computer and use it in GitHub Desktop.
Automatic one-time bootstrapping of NEO test chain in Docker (please check README)
This is a Docker example of automatically bootstrapping the NEO test chain in neo-python if needed.
It wil only run the bootstrap script if no chain is present in /neo-python/Chains/SC234. As the data in this dir is not persistent, it needs to be mounted as a volume.
After running the bootstrap script, the prompt.py script gets fired up. If a volume with dir /neo-python/Chains is mounted, prompt.py is fired up immediately.
Steps to do this:
1. Put the Dockerfile and entrypoint.sh in a directory together.
2. cd to that directory and create a subdirectory test_chain
3. run "docker build -t neo-python ."
4. run "docker run -it -v /absolute/path/to/test_chain/:/neo-python/Chains"
The bootstrap script should now start downloading the fixtures.
If you want to add a wallet to the container, simply add "-v /absolute/path/to/wallet:/path/to/wallet/in/container" to the run command.
FROM ubuntu:16.04
RUN apt-get update && apt-get -y install git python3-dev python3-pip libleveldb-dev libssl-dev screen
RUN git clone https://github.com/CityOfZion/neo-python.git
WORKDIR /neo-python
RUN git checkout development
RUN pip3 install -r requirements.txt
RUN rm -rf /neo-python/Chains/SC234/
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
CMD /entrypoint.sh
!/bin/bash
rm -rf /neo-python/Chains/privatenet
if [ ! -d "/neo-python/Chains/SC234" ]; then
python3 /neo-python/bootstrap.py --skipconfirm
fi
screen python3 /neo-python/prompt.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment