grafana/packaging/docker/push_to_docker_hub.sh

47 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/sh
set -e
2019-01-09 08:50:52 -06:00
_grafana_tag=${1:-}
_docker_repo=${2:-grafana/grafana}
# If the tag starts with v, treat this as a official release
if echo "$_grafana_tag" | grep -q "^v"; then
_grafana_version=$(echo "${_grafana_tag}" | cut -d "v" -f 2)
else
_grafana_version=$_grafana_tag
fi
2018-12-20 15:48:53 -06:00
export DOCKER_CLI_EXPERIMENTAL=enabled
echo "pushing ${_docker_repo}:${_grafana_version}"
2018-12-20 15:48:53 -06:00
docker_push_all () {
repo=$1
tag=$2
# Push each image individually
docker push "${repo}:${tag}"
docker push "${repo}-arm32v7-linux:${tag}"
docker push "${repo}-arm64v8-linux:${tag}"
# Create and push a multi-arch manifest
docker manifest create "${repo}:${tag}" \
"${repo}:${tag}" \
"${repo}-arm32v7-linux:${tag}" \
"${repo}-arm64v8-linux:${tag}"
docker manifest push "${repo}:${tag}"
}
if echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -vq "beta"; then
echo "pushing ${_docker_repo}:latest"
2018-12-20 15:48:53 -06:00
docker_push_all "${_docker_repo}" "latest"
2019-01-09 08:50:52 -06:00
docker_push_all "${_docker_repo}" "${_grafana_version}"
elif echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -q "beta"; then
docker_push_all "${_docker_repo}" "${_grafana_version}"
elif echo "$_grafana_tag" | grep -q "master"; then
2018-12-20 15:48:53 -06:00
docker_push_all "grafana/grafana" "master"
2019-01-09 08:50:52 -06:00
docker push "grafana/grafana-dev:${_grafana_version}"
fi