github.com/m3db/m3@v1.5.1-0.20231129193456-75a402aa583b/scripts/comparator/setup.sh (about) 1 #!/usr/bin/env bash 2 3 set -xe 4 5 # expected to be run from root of repository 6 cd $GOPATH/src/github.com/m3db/m3 7 8 REVISION=$(git rev-parse HEAD) 9 CLEAN=${CLEAN:-false} 10 REBUILD=${REBUILD:-true} 11 if [[ "$CLEAN" == "true" ]]; then 12 make clean 13 fi 14 mkdir -p ./bin 15 16 # by keeping all the required files in ./bin, it makes the build context 17 # for docker much smaller 18 cp ./src/query/config/m3query-dev-remote.yml ./bin 19 20 SERVICES=(m3comparator m3query) 21 # build images 22 echo "building docker images" 23 function build_image { 24 local svc=$1 25 echo "creating image for $svc" 26 make ${svc}-linux-amd64 27 docker build -t "${svc}:${REVISION}" -f ./scripts/comparator/${svc}.Dockerfile ./bin 28 } 29 30 if [[ "$SERVICE" != "" ]]; then 31 # optionally build just for a single service 32 build_image $SERVICE 33 else 34 # otherwise build all images 35 for SVC in ${SERVICES[@]}; do 36 # only build if image doesn't exist 37 if [[ "$(docker images -q ${SVC}_integration:${REVISION} 2> /dev/null)" == "" ]]; then 38 build_image $SVC 39 else 40 if [[ "$REBUILD" == "true" ]]; then 41 build_image $SVC 42 fi 43 fi 44 done 45 fi