Skip to content

Instantly share code, notes, and snippets.

@wrboyce
Last active June 26, 2019 15:58
Show Gist options
  • Save wrboyce/dda9564dd45483cfca5662f79aa8c6c1 to your computer and use it in GitHub Desktop.
Save wrboyce/dda9564dd45483cfca5662f79aa8c6c1 to your computer and use it in GitHub Desktop.
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