Last active
November 10, 2021 12:38
-
-
Save onacit/036c93befff929a1f43b7603aa0b65bb to your computer and use it in GitHub Desktop.
Using docker for building a gradle project with alternative JDKs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# https://gist.github.com/onacit/036c93befff929a1f43b7603aa0b65bb | |
if [ $# -lt 3 ]; then | |
echo "Usage: $0 <tag> <tasks...>, e.g. $0 6.0.1-jdk11 -Pprofile=local clean build" | |
echo "See https://hub.docker.com/_/gradle for available tags" | |
exit 1 | |
fi | |
tag="$1" | |
shift | |
name=$(basename "$PWD") | |
docker run -it --rm -u gradle \ | |
--name "$name" \ | |
-v gradle_cache:/home/gradle/.gradle \ | |
-v "$(pwd)":/usr/src/myproject \ | |
-w /usr/src/myproject \ | |
gradle:"$tag" gradle "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment