From c8f7516b9284ceb5caaacc6c9cd59a58a53d3b69 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Mon, 30 Nov 2020 01:07:07 +0200 Subject: [PATCH] Refactor ganache Dockerfile to use env vars --- docker/ganache/Dockerfile | 21 ++++++--------------- docker/ganache/start-blockchain.sh | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 docker/ganache/start-blockchain.sh diff --git a/docker/ganache/Dockerfile b/docker/ganache/Dockerfile index 0489e23..80eba88 100644 --- a/docker/ganache/Dockerfile +++ b/docker/ganache/Dockerfile @@ -2,18 +2,9 @@ FROM trufflesuite/ganache-cli:latest RUN mkdir /home/ganache_db /home/ganache_keys -ENTRYPOINT ["node", \ - "/app/ganache-core.docker.cli.js", \ - "-a", "10", \ - "-e", "1000", \ - "-d", \ - "-m", "myth like bonus scare over problem client lizard pioneer submit female collect", \ - "-p", "8545", \ - "-i", "5778", \ - "--db", "/home/ganache_db/", \ - "-v", \ - "-h", "0.0.0.0", \ - "--account_keys_path", "/home/ganache_keys/keys.json", \ - "--allowUnlimitedContractSize", \ - "--noVMErrorsOnRPCResponse" \ -] +WORKDIR /opt/concordia-ganache + +COPY ./docker/ganache/start-blockchain.sh . +RUN ["chmod", "+x", "/opt/concordia-ganache/start-blockchain.sh"] + +ENTRYPOINT ["/opt/concordia-ganache/start-blockchain.sh"] diff --git a/docker/ganache/start-blockchain.sh b/docker/ganache/start-blockchain.sh new file mode 100644 index 0000000..49dbaa7 --- /dev/null +++ b/docker/ganache/start-blockchain.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +N_ACCOUNTS="${ACCOUNTS_NUMBER:-10}" +ETHER="${ACCOUNTS_ETHER:-1000}" +MNEMONIC="${MNEMONIC:-"myth like bonus scare over problem client lizard pioneer submit female collect"}" +HOST="${HOST:-"0.0.0.0"}" +PORT="${PORT:-8545}" +ID="${NETWORK_ID:-5778}" + +node /app/ganache-core.docker.cli.js \ + -a "$N_ACCOUNTS" \ + -e "$ETHER" \ + -m "$MNEMONIC" \ + -h "$HOST" \ + -p "$PORT" \ + -i "$ID" \ + --account_keys_path "/home/ganache_keys/keys.json" \ + --db "/home/ganache_db/" \ + --allowUnlimitedContractSize \ + --noVMErrorsOnRPCResponse \ + -d \ + -v