summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin André <martin.andre@kvhasia.com>2014-12-01 15:28:38 +0900
committerMartin André <martin.andre@kvhasia.com>2014-12-04 17:27:18 +0900
commitfb9259d4266f7ddc8411072df787082511c86798 (patch)
treef06a6b3b84bee093e600d19daa1834c99a97b259
parent7f66766c9c433238923a6011405af9b7bc321228 (diff)
downloadkolla-fb9259d4266f7ddc8411072df787082511c86798.tar.gz
kolla-fb9259d4266f7ddc8411072df787082511c86798.zip
Allow building docker image from anywhere
Record the image directory path to a variable and use it instead of the current directory to allow the build script to work independently of the location. Closes-Bug: 1398648 Change-Id: I84c52e41e43af10998f8e9267ccc059eca716c1c
-rwxr-xr-xtools/build-docker-image7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/build-docker-image b/tools/build-docker-image
index 469c63207..370463dd2 100755
--- a/tools/build-docker-image
+++ b/tools/build-docker-image
@@ -1,6 +1,7 @@
#!/bin/bash
TOPDIR=$(git rev-parse --show-toplevel)
+IMGDIR="$(cd "$(dirname "$0")" && pwd)"
RELEASE_NAMESPACE=kollaglue
NAMESPACE=kollaglue
@@ -21,7 +22,7 @@ Options:
EOF
}
-[ -f ./.buildconf ] && . ./.buildconf
+[ -f $IMGDIR/.buildconf ] && . $IMGDIR/.buildconf
[ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf
ARGS=$(getopt -o 'n:t:pN' -l help,namespace:,push,release,tag:,no-cache -- "$@") || { usage >&2; exit 2; }
@@ -72,7 +73,7 @@ if [ "$NAMESPACE" = "$RELEASE_NAMESPACE" ] \
exit 1
fi
-IMAGE="${PREFIX}${PWD##*/}"
+IMAGE="${PREFIX}${IMGDIR##*/}"
FULLIMAGE="${NAMESPACE}/${IMAGE}${TAG:+:${TAG}}"
cat <<EOF
@@ -87,7 +88,7 @@ if [ "$MODE" = "release" ]; then
echo
fi
-if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" .; then
+if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $IMGDIR; then
echo "ERROR: failed to build $FULLIMAGE"
exit 1
fi