diff --git a/polkadot/.dockerignore b/polkadot/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..2b0e81eaf0a60d5fa67ff3a0cdaa32ff7fd07bb2 --- /dev/null +++ b/polkadot/.dockerignore @@ -0,0 +1,2 @@ +doc +target diff --git a/polkadot/docker/build.sh b/polkadot/docker/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..a4c6831676ff26af54898a37a4f6b75d48fb18ce --- /dev/null +++ b/polkadot/docker/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -e + +pushd . + +# The following line ensure we run from the project root +PROJECT_ROOT=`git rev-parse --show-toplevel` +cd $PROJECT_ROOT + +# Find the current version from Cargo.toml +VERSION=`grep "^version" ./Cargo.toml | egrep -o "([0-9\.]+)"` +GITUSER=chevdor +GITREPO=polkadot + +# Build the image +echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!" +time docker build -f ./docker/Dockerfile --build-arg PROFILE=release -t ${GITUSER}/${GITREPO}:latest . + +# Show the list of available images for this repo +echo "Image is ready" +docker images | grep ${GITREPO} + +echo -e "\nIf you just built version ${VERSION}, you may want to update your tag:" +echo " $ docker tag ${GITUSER}/${GITREPO}:$VERSION ${GITUSER}/${GITREPO}:${VERSION}" + +popd diff --git a/polkadot/docker/docker-compose-local.yml b/polkadot/docker/docker-compose-local.yml new file mode 100644 index 0000000000000000000000000000000000000000..c8097c60793faf67e50889fcbfd1a75abf27b7cc --- /dev/null +++ b/polkadot/docker/docker-compose-local.yml @@ -0,0 +1,44 @@ +version: '3' +services: + node_alice: + build: + context: . + ports: + - "30333:30333" + - "9933:9933" + - "9944:9944" + image: chevdor/polkadot:latest + volumes: + - "polkadot-data-alice:/data" + command: polkadot --chain=local --validator --key Alice -d /data --node-key 0000000000000000000000000000000000000000000000000000000000000001 + networks: + testing_net: + ipv4_address: 172.28.1.1 + + node_bob: + build: + context: . + ports: + - "30344:30344" + - "9935:9935" + - "9945:9945" + image: chevdor/polkadot:latest + volumes: + - "polkadot-data-bob:/data" + links: + - "node_alice:alice" + command: polkadot --chain=local --validator --key Bob -d /data --port 30344 --rpc-port 9935 --ws-port 9945 --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN' + networks: + testing_net: + ipv4_address: 172.28.1.2 + +volumes: + polkadot-data-alice: + polkadot-data-bob: + +networks: + testing_net: + ipam: + driver: default + config: + - subnet: 172.28.0.0/16 diff --git a/polkadot/docker/docker-compose.yml b/polkadot/docker/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..b76d41da1d03a3d560d6b045e36d0ac4984a5080 --- /dev/null +++ b/polkadot/docker/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' +services: + polkadot: + build: + context: . + ports: + - "127.0.0.1:30333:30333/tcp" + - "127.0.0.1:9933:9933/tcp" + image: chevdor/polkadot:latest + volumes: + - "polkadot-data:/data" + command: polkadot + +volumes: + polkadot-data: diff --git a/polkadot/docker/readme-docker.adoc b/polkadot/docker/readme-docker.adoc new file mode 100644 index 0000000000000000000000000000000000000000..6e41f792cc22b19877c20189a5ef2ebba831aa40 --- /dev/null +++ b/polkadot/docker/readme-docker.adoc @@ -0,0 +1,16 @@ + +== Polkadot Docker + +=== Start a Polkadot docker container + +Run the following command + + docker run -d -P --name polkadot chevdor/polkadot:latest + +=== Building the image + +To build your own image from the source, you can run the following command: + + ./docker/build.sh + +NOTE: Building the image takes a while. Count at least 30min on a good machine.