2018-07-26 06:40:52 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-12-20 15:48:53 -06:00
|
|
|
_grafana_tag=${1:-}
|
|
|
|
_docker_repo=${2:-grafana/grafana}
|
2018-07-26 06:40:52 -05:00
|
|
|
|
2018-07-30 07:05:56 -05:00
|
|
|
# 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-07-30 09:35:30 -05:00
|
|
|
echo "Building ${_docker_repo}:${_grafana_version}"
|
2018-07-26 06:40:52 -05:00
|
|
|
|
2018-12-20 15:48:53 -06:00
|
|
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
|
|
|
|
|
|
# Build grafana image for a specific arch
|
|
|
|
docker_build () {
|
|
|
|
base_image=$1
|
|
|
|
grafana_tgz=$2
|
|
|
|
tag=$3
|
|
|
|
|
|
|
|
docker build \
|
|
|
|
--build-arg BASE_IMAGE=${base_image} \
|
|
|
|
--build-arg GRAFANA_TGZ=${grafana_tgz} \
|
|
|
|
--tag "${tag}" \
|
|
|
|
--no-cache=true .
|
|
|
|
}
|
|
|
|
|
|
|
|
# Tag docker images of all architectures
|
|
|
|
docker_tag_all () {
|
|
|
|
repo=$1
|
|
|
|
tag=$2
|
|
|
|
docker tag "${_docker_repo}:${_grafana_version}" "${repo}:${tag}"
|
|
|
|
docker tag "${_docker_repo}-arm32v7-linux:${_grafana_version}" "${repo}-arm32v7-linux:${tag}"
|
|
|
|
docker tag "${_docker_repo}-arm64v8-linux:${_grafana_version}" "${repo}-arm64v8-linux:${tag}"
|
|
|
|
}
|
|
|
|
|
|
|
|
docker_build "debian:stretch-slim" "grafana-latest.linux-x64.tar.gz" "${_docker_repo}:${_grafana_version}"
|
|
|
|
docker_build "arm32v7/debian:stretch-slim" "grafana-latest.linux-armv7.tar.gz" "${_docker_repo}-arm32v7-linux:${_grafana_version}"
|
|
|
|
docker_build "arm64v8/debian:stretch-slim" "grafana-latest.linux-arm64.tar.gz" "${_docker_repo}-arm64v8-linux:${_grafana_version}"
|
2018-07-26 06:40:52 -05:00
|
|
|
|
2018-07-30 07:05:56 -05:00
|
|
|
# Tag as 'latest' for official release; otherwise tag as grafana/grafana:master
|
|
|
|
if echo "$_grafana_tag" | grep -q "^v"; then
|
2018-12-20 15:48:53 -06:00
|
|
|
docker_tag_all "${_docker_repo}" "latest"
|
2018-07-26 06:40:52 -05:00
|
|
|
else
|
2018-12-20 15:48:53 -06:00
|
|
|
docker_tag_all "${_docker_repo}" "master"
|
2019-01-10 06:46:03 -06:00
|
|
|
docker tag "${_docker_repo}:${_grafana_version}" "grafana/grafana-dev:${_grafana_version}"
|
2018-07-26 06:40:52 -05:00
|
|
|
fi
|