Browse Source

add new clean command to dojo.sh

umbrel
kenshin-samourai 5 years ago
parent
commit
f8df0e37bb
  1. 2
      doc/DOCKER_setup.md
  2. 27
      docker/my-dojo/dojo.sh

2
doc/DOCKER_setup.md

@ -163,6 +163,8 @@ Available commands:
bitcoin-cli Launch a bitcoin-cli console for interacting with bitcoind RPC API.
clean Free disk space by deleting docker dangling images and images of previous versions.
install Install your Dojo.
logs [module] [options] Display the logs of your Dojo. Use CTRL+C to stop the logs.

27
docker/my-dojo/dojo.sh

@ -12,7 +12,7 @@ source_file() {
source_file "$DIR/conf/docker-bitcoind.conf"
source_file "$DIR/.env"
# Docker up
docker_up() {
source_file "$DIR/conf/docker-bitcoind.conf"
@ -97,6 +97,26 @@ uninstall() {
docker volume prune
}
# Clean-up (remove old docker images)
del_images_for() {
# $1: image name
# $2: most recent version of the image (do not delete this one)
docker image ls | grep "$1" | sed "s/ \+/,/g" | cut -d"," -f2 | while read -r version ; do
if [ "$2" != "$version" ]; then
docker image rm "$1:$version"
fi
done
}
clean() {
docker image prune
del_images_for samouraiwallet/dojo-db "$DOJO_DB_VERSION_TAG"
del_images_for samouraiwallet/dojo-bitcoind "$DOJO_BITCOIND_VERSION_TAG"
del_images_for samouraiwallet/dojo-nodejs "$DOJO_NODEJS_VERSION_TAG"
del_images_for samouraiwallet/dojo-nginx "$DOJO_NGINX_VERSION_TAG"
del_images_for samouraiwallet/dojo-tor "$DOJO_TOR_VERSION_TAG"
}
# Upgrade
upgrade() {
source "$DIR/install/upgrade-scripts.sh"
@ -183,6 +203,8 @@ help() {
echo " "
echo " bitcoin-cli Launch a bitcoin-cli console allowing to interact with your full node through its RPC API."
echo " "
echo " clean Free disk space by deleting docker dangling images and images of previous versions."
echo " "
echo " install Install your dojo."
echo " "
echo " logs [module] [options] Display the logs of your dojo. Use CTRL+C to stop the logs."
@ -255,6 +277,9 @@ case "$subcommand" in
help )
help
;;
clean )
clean
;;
install )
install $1
;;

Loading…
Cancel
Save