github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/k8s/scripts/buildImageHelper (about) 1 #!/usr/bin/env bash 2 3 # Runs compiled go executables and specificies the test to run 4 # Builds executable go test binaries for this repos tests 5 6 set -ex 7 8 buildImage() { 9 SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 10 11 cd "$SCRIPT_DIR"/../ || exit 1 12 13 local TAG_VERSION="${1}" 14 local REPO="${2}" 15 local DOCKER_FILE="${3}" 16 local ARGS=$4 17 local ACCOUNT=$(aws sts get-caller-identity | jq -r .Account) 18 local TAG="${ACCOUNT}".dkr.ecr.us-west-2.amazonaws.com/"${REPO}":"${TAG_VERSION}" 19 20 if [ "${TAG_VERSION}" = "" ]; then 21 echo "Need an argument for the image tag version in argument 1" 22 exit 1 23 fi 24 25 if [ "${REPO}" = "" ]; then 26 echo "Need an argument for the ecr name" 27 exit 1 28 fi 29 30 if [ "${DOCKER_FILE}" = "" ]; then 31 echo "Need an argument for the Dockerfile location" 32 exit 1 33 fi 34 35 36 docker build -t "${TAG}" -f "${DOCKER_FILE}" $ARGS . 37 aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin "${ACCOUNT}".dkr.ecr.us-west-2.amazonaws.com 38 docker push "${TAG}" 39 }