#!/usr/bin/env bash # Build the headquarters-api image (services/api/build.sh) and push it to ECR. # # services/api/push.sh # # REGISTRY overrides the registry-plus-namespace; the default is what infra's # `tofu output -raw ecr_push_registry` prints, all of which is fixed. # The image is tagged with the branch and commit sha, so a task definition # pins a build, not a moving tag. set -euo pipefail : "${AWS_PROFILE:?set AWS_PROFILE; default credentials are almost never the right account}" REGISTRY="${REGISTRY:-179302349187.dkr.ecr.us-east-1.amazonaws.com/lance-blue}" IMAGE_NAME=headquarters-api cd "$(dirname "$0")/../.." BUILD_REF="$(scripts/build-ref.sh)" export BUILD_REF REGISTRY image="$REGISTRY/$IMAGE_NAME:$BUILD_REF" services/api/build.sh aws ecr get-login-password --region us-east-1 \ | docker login --username AWS --password-stdin "${REGISTRY%%/*}" docker push "$image" echo echo "Pushed $image"