Docker: optimise container beacon_node for server CPU [skip ci]

This means that we can no longer do "docker run" locally, so we compile
a local beacon_node with the same flags as the container one.
This commit is contained in:
Ștefan Talpalaru 2020-02-11 18:41:25 +01:00
parent e54f738715
commit 8df447d497
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 15 additions and 12 deletions

View File

@ -55,37 +55,40 @@ fi
mkdir -p "$DEPOSITS_DIR_ABS" mkdir -p "$DEPOSITS_DIR_ABS"
DOCKER_BEACON_NODE="docker run -v $DEPOSITS_DIR_ABS:/deposits_dir -v $NETWORK_DIR_ABS:/network_dir -v $DATA_DIR_ABS:/data_dir statusteam/nimbus_beacon_node:$NETWORK" #DOCKER_BEACON_NODE="docker run -v $DEPOSITS_DIR_ABS:/deposits_dir -v $NETWORK_DIR_ABS:/network_dir -v $DATA_DIR_ABS:/data_dir statusteam/nimbus_beacon_node:$NETWORK"
make deposit_contract
if [ "$ETH1_PRIVATE_KEY" != "" ]; then if [ "$ETH1_PRIVATE_KEY" != "" ]; then
make deposit_contract
echo "Deploying deposit contract through $WEB3_URL_ARG..." echo "Deploying deposit contract through $WEB3_URL_ARG..."
DEPOSIT_CONTRACT_ADDRESS=$(./build/deposit_contract deploy $WEB3_URL_ARG --private-key=$ETH1_PRIVATE_KEY) DEPOSIT_CONTRACT_ADDRESS=$(./build/deposit_contract deploy $WEB3_URL_ARG --private-key=$ETH1_PRIVATE_KEY)
DEPOSIT_CONTRACT_ADDRESS_ARG="--deposit-contract=$DEPOSIT_CONTRACT_ADDRESS" DEPOSIT_CONTRACT_ADDRESS_ARG="--deposit-contract=$DEPOSIT_CONTRACT_ADDRESS"
echo "Done: $DEPOSIT_CONTRACT_ADDRESS" echo "Done: $DEPOSIT_CONTRACT_ADDRESS"
fi fi
echo "Building a local beacon_node instance for 'makeDeposits' and 'createTestnet'"
make NIMFLAGS="-d:insecure -d:testnet_servers_image ${NETWORK_NIM_FLAGS}" beacon_node
cd docker cd docker
echo "Building Docker image..." echo "Building Docker image..."
# we're running this Docker image both locally and on the servers # CPU-specific CFLAGS that work on the servers are in MARCH_NIM_FLAGS,
make MARCH_NIM_FLAGS="-d:disableMarchNative" build # in docker/Makefile, and are enabled by default.
make build
$DOCKER_BEACON_NODE makeDeposits \ ../build/beacon_node makeDeposits \
--quickstart-deposits=$QUICKSTART_VALIDATORS \ --quickstart-deposits=$QUICKSTART_VALIDATORS \
--random-deposits=$RANDOM_VALIDATORS \ --random-deposits=$RANDOM_VALIDATORS \
--deposits-dir=/deposits_dir --deposits-dir="$DEPOSITS_DIR_ABS"
TOTAL_VALIDATORS="$(( $QUICKSTART_VALIDATORS + $RANDOM_VALIDATORS ))" TOTAL_VALIDATORS="$(( $QUICKSTART_VALIDATORS + $RANDOM_VALIDATORS ))"
$DOCKER_BEACON_NODE createTestnet \ ../build/beacon_node createTestnet \
--data-dir=/data_dir \ --data-dir="$DATA_DIR_ABS" \
--validators-dir=/deposits_dir \ --validators-dir="$DEPOSITS_DIR_ABS" \
--total-validators=$TOTAL_VALIDATORS \ --total-validators=$TOTAL_VALIDATORS \
--last-user-validator=$QUICKSTART_VALIDATORS \ --last-user-validator=$QUICKSTART_VALIDATORS \
--output-genesis=/network_dir/genesis.ssz \ --output-genesis="$NETWORK_DIR_ABS/genesis.ssz" \
--output-bootstrap-file=/network_dir/bootstrap_nodes.txt \ --output-bootstrap-file="$NETWORK_DIR_ABS/bootstrap_nodes.txt" \
--bootstrap-address=$BOOTSTRAP_IP \ --bootstrap-address=$BOOTSTRAP_IP \
--bootstrap-port=$BOOTSTRAP_PORT \ --bootstrap-port=$BOOTSTRAP_PORT \
$WEB3_URL_ARG $DEPOSIT_CONTRACT_ADDRESS_ARG \ $WEB3_URL_ARG $DEPOSIT_CONTRACT_ADDRESS_ARG \