Add script to extract binaries from prebuilt cli-bin image (#1388)

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
This commit is contained in:
Kevin Lingerfelt 2018-07-31 15:56:35 -07:00 committed by GitHub
parent 5963fe7cf6
commit 7530b92abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 0 deletions

40
bin/docker-pull-binaries Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
set -eu
if [ $# -eq 1 ]; then
tag="${1:-}"
else
echo "usage: $(basename $0) tag" >&2
exit 64
fi
bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir="$( cd $bindir/.. && pwd )"
. $bindir/_docker.sh
workdir="$rootdir/target/release"
mkdir -p "$workdir"
shorttag="$tag"
if [ "${tag:0:1}" == "v" ]; then
shorttag="${tag:1}"
fi
# create the cli-bin container in order to extract the binaries
id=$(docker create "$(docker_repo cli-bin):$tag")
for os in darwin linux windows ; do
ext="$os"
if [ "$os" == "windows" ]; then
ext="windows.exe"
fi
filepath="$workdir/linkerd2-cli-$shorttag-$ext"
docker cp "$id:/out/linkerd-$os" "$filepath"
openssl dgst -sha256 "$filepath" | awk '{print $2}' > "$filepath.sha256"
echo "$filepath"
done
# cleanup the cli-bin container when finished
docker rm "$id" > /dev/null