Run a fullnode+drone automatically when the container starts up

This commit is contained in:
Michael Vines 2018-10-02 17:34:47 -07:00
parent 3fa46dd66d
commit beb4536841
No known key found for this signature in database
GPG Key ID: 33F4FDEC4E0E88BD
4 changed files with 48 additions and 4 deletions

View File

@ -1,5 +1,13 @@
FROM debian:stretch
# JSON RPC port
EXPOSE 8899/tcp
# Install libssl
RUN apt update && \
apt-get install -y libssl-dev && \
rm -rf /var/lib/apt/lists/*
COPY cargo-install/bin /usr/bin/
COPY usr/bin /usr/bin/
ENTRYPOINT [ "/usr/bin/solana-entrypoint.sh" ]
CMD [""]

View File

@ -1,5 +1,17 @@
## Minimal Solana Docker image
This image is automatically updated by CI
https://hub.docker.com/r/solanalabs/solana/
### Usage:
Run the latest beta image:
```bash
$ docker run --rm -p 8899:8899 solanalabs/solana:beta
```
Run the latest edge image:
```bash
$ docker run --rm -p 8899:8899 solanalabs/solana:edge
```
Port *8899* is the JSON RPC port, which is used by clients to communicate with the network.

View File

@ -16,9 +16,10 @@ if [[ -z $CHANNEL ]]; then
exit 0
fi
rm -rf cargo-install/
rm -rf usr/
../docker-run.sh solanalabs/rust:1.29.1 \
cargo install --path . --root ci/docker-solana/cargo-install
cargo install --path . --root ci/docker-solana/usr
cp -f entrypoint.sh usr/bin/solana-entrypoint.sh
docker build -t solanalabs/solana:$CHANNEL .

23
ci/docker-solana/entrypoint.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash -ex
export RUST_LOG=solana=info
export RUST_BACKTRACE=1
solana-keygen -o /config/leader-keypair.json
solana-keygen -o /config/drone-keypair.json
solana-genesis --tokens=1000000000 --ledger /ledger < /config/drone-keypair.json
solana-fullnode-config --keypair=/config/leader-keypair.json -l > /config/leader-config.json
solana-drone --keypair /config/drone-keypair.json --network 127.0.0.1:8001 &
drone=$!
solana-fullnode --identity /config/leader-config.json --ledger /ledger/ &
fullnode=$!
abort() {
kill "$drone" "$fullnode"
}
trap abort SIGINT SIGTERM
wait "$fullnode"
kill "$drone" "$fullnode"