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
This commit is contained in:
53
cleanup-frontend.sh
Executable file
53
cleanup-frontend.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/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!"
|
||||
Reference in New Issue
Block a user