#!/usr/bin/env bash set -eu if [ $# -ne 0 ]; then echo "no arguments allowed for ${0##*/}, given: $*" >&2 exit 64 fi bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd ) rootdir=$( cd "$bindir"/.. && pwd ) # shellcheck source=_docker.sh . "$bindir"/_docker.sh # shellcheck source=_tag.sh . "$bindir"/_tag.sh dockerfile=$rootdir/cli/Dockerfile-bin validate_go_deps_tag "$dockerfile" ( "$bindir"/docker-build-go-deps ) >/dev/null tag=$(head_root_tag) docker_build cli-bin "$tag" "$dockerfile" --build-arg LINKERD_VERSION="$tag" IMG=$(docker_repo cli-bin):$tag ID=$(docker create "$IMG") # copy the newly built linkerd cli binaries to the local system for OS in darwin linux windows ; do DIR=$rootdir/target/cli/$OS mkdir -p "$DIR" if docker cp "$ID:/out/linkerd-${OS}" "$DIR/linkerd" ; then echo "$DIR/linkerd" else docker rm "$ID" >/dev/null exit 1 fi done docker rm "$ID" >/dev/null