Merge pull request #419 from ShaneLee/bug/builder-directory
Make builder script run relative to directory it was called from
This commit is contained in:
commit
9057e3c8d1
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
# Build a container using the spec file provided
|
# Build a container using the spec file provided
|
||||||
|
|
||||||
|
START_DIR=$PWD
|
||||||
|
cd "$(dirname "$BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
help_msg(){
|
help_msg(){
|
||||||
echo "Usage: $0 [specfile] [tag]"
|
echo "Usage: $0 [specfile] [tag]"
|
||||||
echo
|
echo
|
||||||
|
@ -37,14 +40,14 @@ fetch_packages(){
|
||||||
}
|
}
|
||||||
|
|
||||||
build_container(){
|
build_container(){
|
||||||
docker build -t $1 -f "$(dirname $0)/Dockerfile" "$PWD/build"
|
docker build -t $1 -f "Dockerfile" "$START_DIR/build"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SPEC_FILE=$1
|
SPEC_FILE=$START_DIR/$1
|
||||||
TAG=$2
|
TAG=$2
|
||||||
|
|
||||||
[ -z "$SPEC_FILE" ] && help_msg "specfile is required"
|
[ -z "$1" ] && help_msg "specfile is required"
|
||||||
[ -z "$TAG" ] && help_msg "tag is required"
|
[ -z "$TAG" ] && help_msg "tag is required"
|
||||||
|
|
||||||
[ -f "$SPEC_FILE" ] || help_msg "specfile does not exist"
|
[ -f "$SPEC_FILE" ] || help_msg "specfile does not exist"
|
||||||
|
@ -58,4 +61,4 @@ fetch_packages $SPEC_FILE
|
||||||
build_container $TAG
|
build_container $TAG
|
||||||
|
|
||||||
echo "Start your custom piston container with"
|
echo "Start your custom piston container with"
|
||||||
echo "$ docker run --tmpfs /piston/jobs -dit -p 2000:2000 $TAG"
|
echo "$ docker run --tmpfs /piston/jobs -dit -p 2000:2000 $TAG"
|
||||||
|
|
Loading…
Reference in New Issue