@@ -4,6 +4,7 @@ set -euo pipefail
4
4
5
5
# e.g.,
6
6
# ./scripts/build_image.sh # Build local single-arch image
7
+ # SKIP_BUILD_RACE=1 ./scripts/build_image.sh # Build local single-arch image but skip building -r image
7
8
# DOCKER_IMAGE=myavalanchego ./scripts/build_image.sh # Build local single arch image with a custom image name
8
9
# DOCKER_IMAGE=avaplatform/avalanchego ./scripts/build_image.sh # Build and push multi-arch image to docker hub
9
10
# DOCKER_IMAGE=localhost:5001/avalanchego ./scripts/build_image.sh # Build and push multi-arch image to private registry
@@ -25,10 +26,12 @@ set -euo pipefail
25
26
# Directory above this script
26
27
AVALANCHE_PATH=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; cd .. && pwd )
27
28
29
+ SKIP_BUILD_RACE=" ${SKIP_BUILD_RACE:- } "
30
+
28
31
# Load the constants
29
32
source " $AVALANCHE_PATH " /scripts/constants.sh
30
33
31
- if [[ $image_tag == * " -r" ]]; then
34
+ if [[ -z " ${SKIP_BUILD_RACE} " && $image_tag == * " -r" ]]; then
32
35
echo " Branch name must not end in '-r'"
33
36
exit 1
34
37
fi
@@ -84,9 +87,11 @@ echo "Building Docker Image with tags: $DOCKER_IMAGE:$commit_hash , $DOCKER_IMAG
84
87
${DOCKER_CMD} -t " $DOCKER_IMAGE :$commit_hash " -t " $DOCKER_IMAGE :$image_tag " \
85
88
" $AVALANCHE_PATH " -f " $AVALANCHE_PATH /Dockerfile"
86
89
87
- echo " Building Docker Image with tags: $DOCKER_IMAGE :$commit_hash -r , $DOCKER_IMAGE :$image_tag -r"
88
- ${DOCKER_CMD} --build-arg=" RACE_FLAG=-r" -t " $DOCKER_IMAGE :$commit_hash -r" -t " $DOCKER_IMAGE :$image_tag -r" \
89
- " $AVALANCHE_PATH " -f " $AVALANCHE_PATH /Dockerfile"
90
+ if [[ -z " ${SKIP_BUILD_RACE} " ]]; then
91
+ echo " Building Docker Image with tags: $DOCKER_IMAGE :$commit_hash -r , $DOCKER_IMAGE :$image_tag -r"
92
+ ${DOCKER_CMD} --build-arg=" RACE_FLAG=-r" -t " $DOCKER_IMAGE :$commit_hash -r" -t " $DOCKER_IMAGE :$image_tag -r" \
93
+ " $AVALANCHE_PATH " -f " $AVALANCHE_PATH /Dockerfile"
94
+ fi
90
95
91
96
# Only tag the latest image for the master branch when images are pushed to a registry
92
97
if [[ " ${DOCKER_IMAGE} " == * " /" * && $image_tag == " master" ]]; then
0 commit comments