summaryrefslogtreecommitdiff
path: root/tools/build-docker-image
diff options
context:
space:
mode:
authorMartin André <martin.andre@kvhasia.com>2015-05-05 12:33:37 +0900
committerMartin André <martin.andre@kvhasia.com>2015-05-05 12:45:11 +0900
commit047683d12c96f3b1cfddd906a515fd01bc122aa1 (patch)
treed01d65af89101b363bd69bbcc8a6d49fc2abc598 /tools/build-docker-image
parent844d710a48f858533cf67256cd81f051ae35533a (diff)
downloadkolla-047683d12c96f3b1cfddd906a515fd01bc122aa1.tar.gz
kolla-047683d12c96f3b1cfddd906a515fd01bc122aa1.zip
Initial support for taggable dependencies
Introduce a new --no-use-released-parent option to `build-docker-image` that allows specifying whether the parent image uses the same tag as the one that's currently build or the release tag. Default is to use the release tag for parent image, however `build-all-docker-images` script forces it to be the current tag. Change to Dockerfile is coming next. Change-Id: Ief11c9abb722c181ca85f38ee11800dbf4332a5f
Diffstat (limited to 'tools/build-docker-image')
-rwxr-xr-xtools/build-docker-image19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/build-docker-image b/tools/build-docker-image
index adffdf875..974c5a5eb 100755
--- a/tools/build-docker-image
+++ b/tools/build-docker-image
@@ -7,6 +7,7 @@ RELEASE_NAMESPACE=kollaglue
NAMESPACE=kollaglue
PREFIX=centos-rdo-
TAG=$(git rev-parse --short HEAD)
+RELEASE_TAG=icehouse
usage () {
cat <<EOF
@@ -19,13 +20,14 @@ Options:
--push, -p
--no-cache, -N
--release
+--no-use-released-parent
EOF
}
[ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf
[ -f $IMGDIR/.buildconf ] && . $IMGDIR/.buildconf
-ARGS=$(getopt -o hn:t:pN -l help,namespace:,push,release,tag:,no-cache -- "$@") || { usage >&2; exit 2; }
+ARGS=$(getopt -o hn:t:pN -l help,namespace:,push,release,tag:,no-cache,no-use-released-parent -- "$@") || { usage >&2; exit 2; }
eval set -- "$ARGS"
@@ -38,7 +40,7 @@ while :; do
(--release) MODE=release
NAMESPACE=$RELEASE_NAMESPACE
- TAG=latest
+ TAG=$RELEASE_TAG
;;
(--tag|-t) shift
@@ -57,6 +59,10 @@ while :; do
NAMESPACE="$1"
;;
+ (--no-use-released-parent)
+ USE_CURRENT_TAG=1
+ ;;
+
(--) break
;;
@@ -65,8 +71,14 @@ while :; do
shift
done
+if [[ $USE_CURRENT_TAG = 1 ]]; then
+ PARENT_TAG=$TAG
+else
+ PARENT_TAG=$RELEASE_TAG
+fi
+
if [ "$NAMESPACE" = "$RELEASE_NAMESPACE" ] \
- && [ "$TAG" = "latest" ] \
+ && [ "$TAG" = "$RELEASE_TAG" ] \
&& ! [ "$MODE" = "release" ]; then
echo "ERROR: use --release to build a release image" >&2
@@ -94,6 +106,7 @@ cp -aL $IMGDIR/* $TMPDIR
# versions of sed behave differently otherwise
sed -i.bak "s/%%KOLLA_NAMESPACE%%/${NAMESPACE}/g" $TMPDIR/Dockerfile
sed -i.bak "s/%%KOLLA_PREFIX%%/${PREFIX}/g" $TMPDIR/Dockerfile
+sed -i.bak "s/%%KOLLA_TAG%%/${PARENT_TAG}/g" $TMPDIR/Dockerfile
if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then
echo "ERROR: failed to build $FULLIMAGE"