Last active
April 19, 2018 17:33
-
-
Save rbdiang/50107e046e1f8065e65a262f5e1627b5 to your computer and use it in GitHub Desktop.
java without java
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
```bash | |
mkdir ~/bin | |
cat >> ~/bin/docker-java << "BINGOBANGO" | |
#! /bin/env bash | |
if [ "$PWD" = "/" ]; then | |
echo " | |
ERROR: | |
docker-java cannot be executed from $PWD | |
Please change directory to anywhere but $PWD, and try again. | |
Sorry for any inconvienence this may cause you. | |
" | |
exit 1 | |
fi | |
docker run --rm \ | |
-v "$PWD":"$PWD" \ | |
--workdir="$PWD" \ | |
-it \ | |
java:8-jdk-alphine java "${@}}" | |
BINGOBANGO | |
chmod +x ~/bin/docker-java | |
ln -s ~/bin/docker-java java | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment