Files
HarborForge.Test/cleanup-frontend.sh
Zhi 392e050caa Add separate compose files for port exposure options
- docker-compose-frontend.yml: No port exposure (default)
- docker-compose-frontend-expose.yml: Expose ports to host
- run-test-frontend.sh: Test script with --expose-port {on|off} option
- cleanup-frontend.sh: Cleanup script with --expose-port option
2026-03-14 08:08:50 +00:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Cleanup script for HarborForge Frontend Test
# Usage: ./cleanup-frontend.sh [--expose-port {on|off}]
# Default: off
set -e
EXPOSE_PORT="off"
COMPOSE_FILE="docker-compose-frontend.yml"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--expose-port)
EXPOSE_PORT="$2"
shift 2
;;
--expose-port=*)
EXPOSE_PORT="${1#*=}"
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--expose-port {on|off}]"
exit 1
;;
esac
done
# Validate expose-port value
if [[ "$EXPOSE_PORT" != "on" && "$EXPOSE_PORT" != "off" ]]; then
echo "Error: --expose-port must be 'on' or 'off'"
exit 1
fi
# Select compose file based on expose-port
if [[ "$EXPOSE_PORT" == "on" ]]; then
COMPOSE_FILE="docker-compose-frontend-expose.yml"
echo "🔌 Port exposure: ON"
else
echo "🔌 Port exposure: OFF"
fi
echo "📦 Using compose file: $COMPOSE_FILE"
echo "🧹 Cleaning up HarborForge Test containers..."
# Stop and remove containers, networks (keep images)
docker compose -f "$COMPOSE_FILE" down
# Also remove the wizard config volume
docker volume rm harborforgetest_wizard_config 2>/dev/null || true
echo "✅ Cleanup complete!"