Last active
June 26, 2019 15:58
-
-
Save wrboyce/dda9564dd45483cfca5662f79aa8c6c1 to your computer and use it in GitHub Desktop.
This file contains 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
caff () { | |
if [ -z "$(docker images -q caff)" ]; then | |
# shellcheck disable=SC2016 | |
echo 'Bootstrapping `caff` docker image' | |
docker run \ | |
--detach \ | |
--name caff \ | |
debian \ | |
bash -c 'apt-get update -y && apt-get install -y man signing-party && apt-get clean' &>/dev/null | |
while [ -n "$(docker ps -qf name=caff)" ]; do | |
sleep 5 | |
done | |
docker commit caff caff >/dev/null # commit container as image | |
docker rm caff >/dev/null # remove container | |
fi | |
if [ "$1" = "--help" ]; then | |
docker run \ | |
--interactive \ | |
--tty \ | |
--rm \ | |
caff \ | |
man caff | |
else | |
docker run \ | |
--interactive \ | |
--tty \ | |
--rm \ | |
--volume "${HOME}/.caff:/root/.caff" \ | |
--volume "${HOME}/.caffrc:/root/.caffrc" \ | |
--volume "${HOME}/.gnupg:/root/.gnupg" \ | |
caff \ | |
caff "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment