Skip to content

Instantly share code, notes, and snippets.

@blackandred
Last active July 1, 2019 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackandred/596806af853557c53614b0d034327798 to your computer and use it in GitHub Desktop.
Save blackandred/596806af853557c53614b0d034327798 to your computer and use it in GitHub Desktop.
Use dockerized java easily, instead of running java on host. Keeps gradle cached packages in a mapped volume.
#!/bin/bash
SUDO=${SUDO:-sudo}
IMAGE=${IMAGE:-openjdk:8-jre-stretch}
PARAMS="$@"
if [[ ! ${PARAMS} ]]; then
PARAMS="exit 1"
fi
exec ${SUDO} docker run --rm --name djvm \
-i \
-t \
-v $(pwd):/build \
-v $(dirname ~/.gradle/dirname_suffix):/root/.gradle \
${IMAGE} \
/bin/bash -c "cd /build && $PARAMS"
@blackandred
Copy link
Author

When there will be a false lock:

rm ~/.gradle/caches/*/*.lock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment