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
This commit is contained in:
parent
7f66766c9c
commit
fb9259d426
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user