
#!/bin/bash
# Build, tag, and push metrics server docker images to our registry
#
# Usage: ./build_metrics_server_docker_images.sh <tag>
#
# If you don't provide an argument, tag will default to latest
# By convention, we use the current date as the tag, ex: 20180820

set -euo pipefail

tag=${1:-latest}
set -euo pipefail

# Find workspace and set up env
workspace=$(bazel info workspace)
cd ${workspace}
source "$workspace/scripts/shell/bazel/function.sh"

# Pull the latest dds_base since it is used by all of the other images
./docker_images/teleop/dds_base/pull.sh

echo "Building metrics server image"
bazel_run //teleop/metrics/metrics_api:push_metrics_server_image --define metrics_server_image_tag=$tag
echo "Building metrics canary image"
bazel_run //teleop/metrics/metrics_api:push_metrics_canary_image --define metrics_canary_image_tag=$tag
