3
0
Fork 0
medicine-config/uninstall.sh

27 lines
656 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
# Проверка root/sudo
if ! command -v sudo >/dev/null 2>&1; then
echo "Ошибка: sudo не найден."
exit 1
fi
sudo -u medicine bash <<'EOF'
set -euo pipefail
BASE="$HOME/medicine-config"
if [ -d "$BASE" ]; then
cd "$BASE/medicine" && docker compose down
cd "$BASE/postgres" && docker compose down
cd "$BASE/redis" && docker compose down
cd "$BASE/dashboard" && docker compose down
docker images -q --filter=reference='docker.med-logic.ru/*' | xargs -r docker rmi -f
rm -rf "$BASE"
fi
EOF
echo "Готово. Все контейнеры установлены и удалены."