Skip to content

Instantly share code, notes, and snippets.

@rbdiang
Last active April 19, 2018 17:33
Show Gist options
  • Save rbdiang/50107e046e1f8065e65a262f5e1627b5 to your computer and use it in GitHub Desktop.
Save rbdiang/50107e046e1f8065e65a262f5e1627b5 to your computer and use it in GitHub Desktop.
java without java
```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