Skip to content

Commit

Permalink
Build script with no interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
portchris committed Apr 25, 2020
1 parent 86601ad commit 83b7364
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,19 @@ if [ -z ${GROUP_ID+x} ]; then
GROUP_ID=$(id -g)
fi

NO_CACHE="--no-cache"
if [[ $* == *-n* ]]; then
NO_CACHE="--pull"
fi

if [[ $NO_CACHE == "--no-cache" ]]; then
read -p "Use Docker cache? [Y/y]? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
NO_CACHE="--pull"
else
NO_CACHE="--no-cache"
fi
fi

docker-compose build --build-arg UID=$USER_ID --build-arg GID=$GROUP_ID
docker-compose build $NO_CACHE --build-arg UID=$USER_ID --build-arg GID=$GROUP_ID

0 comments on commit 83b7364

Please sign in to comment.