feat: Add bin directory for management scripts

- Add bin/cleanup.sh for system cleanup
- Add bin/docker-manage.sh for Docker management utilities

💘 Generated with Crush

Assisted-by: GLM-4.6 via Crush <crush@charm.land>
This commit is contained in:
2026-01-21 15:39:34 -05:00
parent 503b0ada27
commit 6594f1be1c
2 changed files with 61 additions and 0 deletions

15
bin/cleanup.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
# Self-destruct script to remove Docker containers created by the build process
set -euo pipefail
# Remove the knel-football-builder container if it exists
if docker ps -a --format '{{.Names}}' | grep -q "^knel-football-builder$"; then
echo "Removing knel-football-builder container..."
docker rm -f knel-football-builder
fi
# Remove any anonymous containers related to this project
echo "Removing anonymous containers..."
docker ps -a --filter "label=project=knel-football" -q | xargs -r docker rm -f
echo "Self-destruct completed."

46
bin/docker-manage.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
# Utility script to manage Docker containers
set -euo pipefail
case "${1:-}" in
cleanup | clean)
echo "Removing containers..."
docker ps -a --filter "name=knel-football" -q | xargs -r docker rm -f
docker images --filter "reference=knel-football:*" -q | xargs -r docker rmi -f
echo "Cleanup completed."
;;
stop)
echo "Stopping containers..."
docker ps --filter "name=knel-football" -q | xargs -r docker stop
echo "Containers stopped."
;;
logs)
if [ -z "${2:-}" ]; then
echo "Usage: $0 logs <container>"
exit 1
fi
docker logs "knel-football-${2}"
;;
exec)
if [ -z "${2:-}" ]; then
echo "Usage: $0 exec <container> [command]"
exit 1
fi
shift
docker exec -it "knel-football-${1}" "${@:2}"
;;
status | st)
echo "Container status:"
docker ps -a --filter "name=knel-football" --format "table {{.Names}}\t{{.Status}}"
;;
*)
echo "Usage: $0 {cleanup|stop|logs|exec|status}"
echo "Commands:"
echo " cleanup - Remove all containers and images"
echo " stop - Stop all running containers"
echo " logs - Show container logs"
echo " exec - Execute command in container"
echo " status - Show container status"
exit 1
;;
esac