more docker work

This commit is contained in:
Christian Mehlmauer
2017-04-12 20:13:49 +02:00
parent 0b9b79f55f
commit 8e4643874d
8 changed files with 44 additions and 10 deletions

20
bin/rspec Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR/../
# always rebuild and include all GEMs
docker build --build-arg "BUNDLER_ARGS=--system --jobs=8" -t wpscan:rspec .
# update all gems (this updates Gemfile.lock on the host)
docker run --rm -u root -v $DIR/../Gemfile.lock:/wpscan/Gemfile.lock --entrypoint "" wpscan:rspec bundle update
# rebuild image with latest GEMs
docker build --build-arg "BUNDLER_ARGS=--system --jobs=8" -t wpscan:rspec .
# run spec
docker run --rm -v $DIR/../:/wpscan --entrypoint "" wpscan:rspec rspec

View File

@@ -9,6 +9,6 @@ done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR/../
docker build -q -t wpscan:dev .
docker run --rm wpscan:dev "$@"
docker build -q -t wpscan:git .
docker run --rm wpscan:git "$@"

16
bin/wpscan-dev Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR/../
if [[ -n "$WPSCAN_BUILD" ]]; then
docker build -q -t wpscan:git .
fi
docker run --rm -v $DIR/../:/wpscan wpscan:git "$@"