codex-factory/scripts/bee-cleanup.sh
nugaon 0bce2ed485
feat: docker image builds (#2)
* feat: add cleanup script in favor of many build trials

* feat: create docker images from specific state of spawned bee clients

* chore: add generated Docker files to git

* refactor: remove individual Docker files and create one common

* feat: remove Dockerfile creation and simplify the script

* feat: update common dockerfile on build

* refactor: remove generated Dockerfile from git

* chore: add generated Dockerfile to gitignore

* chore: ignore Dockerfile

* feat: check whether system environment variable is defined

* feat: common variable handling, new bee.sh functionalities and params

* feat: blockchain docker image build script

* feat: environment script to start the created images

* docs: amend readme

* feat: add bee image prefix env variable and its handlings

* feat: env variable handling + image prefix handling

* docs: amend readme

* feat: docker image prune

* docs: amend readme

* chore: echo for sudo password

* chore: echo for sudo password

* fix: environment queen logging

* chore: remove commented out code

* refactor: use osx compatible local variable init

* refactor: use shell check extension and make the script osx compatible

* fix: stop blockchain container as well on interrupting

* fix: rule out commented lines from env checking

* refactor: remove unnecessary echo

* refactor: remove cat command from the .env grep

* refactor: add some quotes to variable references where is necessary
2021-04-29 14:20:43 +02:00

26 lines
913 B
Bash
Executable File

#!/bin/bash
echo "Removing 'localstore' and 'statestore' folders from Bee datadirs..."
echo "You may need to pass your password for sudo permission to remove the bee-data folders"
MY_PATH=$(dirname "$0")
MY_PATH=$( cd "$MY_PATH" && pwd )
BEE_DIRS=$(ls "$MY_PATH/bee-data-dirs")
for BEE_DIR in $BEE_DIRS
do
echo "$BEE_DIR"
BEE_DIR_PATH="$MY_PATH/bee-data-dirs/$BEE_DIR"
sudo rm -rf "$BEE_DIR_PATH/localstore"
sudo rm -rf "$BEE_DIR_PATH/statestore"
done
echo "Removing built Docker images..."
BEE_ENV_PREFIX=$("$MY_PATH/utils/env-variable-value.sh" BEE_ENV_PREFIX)
BEE_VERSION=$("$MY_PATH/utils/env-variable-value.sh" BEE_VERSION)
BEE_IMAGE_PREFIX=$("$MY_PATH/utils/env-variable-value.sh" BEE_IMAGE_PREFIX)
DOCKER_IMAGES=$(docker image ls -qaf reference="$BEE_IMAGE_PREFIX/$BEE_ENV_PREFIX*:$BEE_VERSION")
for DOCKER_IMAGE in $DOCKER_IMAGES
do
echo "$DOCKER_IMAGE"
docker image rm "$DOCKER_IMAGE"
done