From fb9259d4266f7ddc8411072df787082511c86798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Mon, 1 Dec 2014 15:28:38 +0900 Subject: [PATCH] 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 --- tools/build-docker-image | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/build-docker-image b/tools/build-docker-image index 469c63207b..370463dd27 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 <