1
0
mirror of https://github.com/helm/charts.git synced 2026-02-14 18:10:14 +00:00
Files
deprecated-helm-charts/test/publish-docker.sh
2018-02-09 14:07:51 -08:00

64 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
VERSION=v1.10
CONTAINER_NAME=test-image
usage() {
echo "Usage: $0 [-p]" 1>&2;
echo " -p PROJECT_ID"
echo " -d will deploy to gcr.io"
echo " -r REPO_IP will override gcr.io and deploy docker to local repo"
exit 1;
}
if [ $? != 0 ] ; then usage ; fi
while getopts "p:hd" o; do
case "${o}" in
p)
PROJECT_ID=${OPTARG}
;;
d)
DEPLOY=true
;;
r)
REPO_URL=${OPTARG}
;;
h)
usage
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "$PROJECT_ID" ]; then
usage
fi
REPO=gcr.io/$PROJECT_ID
DOCKER="${REPO}/${CONTAINER_NAME}:${VERSION}"
docker build -t ${DOCKER} .
if [ "${DEPLOY}" ]; then
if [ -z $REPO_URL ]; then
gcloud docker push ${DOCKER}
else
docker push ${DOCKER}
fi
fi