From d0455f66b6ee89fc99b0f10222bf675010f4f1d9 Mon Sep 17 00:00:00 2001 From: Christos Hadjiaslanis Date: Fri, 8 Nov 2024 19:48:39 +0000 Subject: [PATCH] deploy-validator.sh uses configurable image. (#2839) --- scripts/deploy-validator.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/scripts/deploy-validator.sh b/scripts/deploy-validator.sh index 832cba603ac..5beb1ec970a 100755 --- a/scripts/deploy-validator.sh +++ b/scripts/deploy-validator.sh @@ -34,13 +34,21 @@ if ! docker_compose_plugin_installed; then exit 1 fi +HOST=$1 + # Check if the host is provided as an argument -if [ -z "$1" ]; then - echo "Usage: $0 " +if [ -z "$HOST" ]; then + echo "Usage: $0 [--remote-image]" exit 1 fi -HOST="$1" +if [ -n "$2" ]; then + if [ "$2" != "--remote-image" ]; then + echo "Usage: $0 [--remote-image]" + exit 1 + fi + REMOTE_IMAGE="$2" +fi # Get the current branch name and replace underscores with dashes BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) @@ -57,6 +65,14 @@ GENESIS_CONFIG="docker/genesis.json" echo "Building Linera binaries" cargo install --locked --path linera-service +if [ -z "$REMOTE_IMAGE" ]; then + echo "Building local image from commit $GIT_COMMIT..." + docker build --build-arg git_commit="$GIT_COMMIT" -f docker/Dockerfile . -t linera +else + export LINERA_IMAGE="us-docker.pkg.dev/linera-io-dev/linera-public-registry/linera:$BRANCH_NAME" + echo "Using remote image $LINERA_IMAGE..." +fi + # Create validator configuration file echo "Creating validator configuration..." cat > $VALIDATOR_CONFIG <