Add Docker-based dev/prod setup with zail helper scripts

This commit is contained in:
zino
2025-11-19 16:03:36 +01:00
parent 28647fce70
commit 5ef73a8041
10 changed files with 479 additions and 7 deletions

63
docker/bin/zail Executable file
View File

@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -e
# Basis-Verzeichnis des Projekts ermitteln
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# Unsere einzige Compose-Datei
COMPOSE_FILE="$BASE_DIR/compose.yaml"
# Standard-Service für Befehle wie "artisan", "npm", etc.
SERVICE="${ZAIL_SERVICE:-workspace}"
dc() {
docker compose -f "$COMPOSE_FILE" "$@"
}
if [[ "$#" -lt 1 ]]; then
echo "Usage: zail [up|down|stop|restart|ps|logs|bash|artisan|composer|npm|yarn|pnpm|<command>...]"
exit 1
fi
CMD="$1"
shift || true
case "$CMD" in
up)
dc up "$@"
;;
down)
dc down "$@"
;;
stop)
# Entspricht in etwa "sail stop"
dc stop "$@"
;;
restart)
dc down
dc up "$@"
;;
ps)
dc ps "$@"
;;
logs)
# Logs aller Services folgen
dc logs -f "$@"
;;
bash|shell|sh)
dc exec "$SERVICE" bash
;;
artisan)
dc exec "$SERVICE" php artisan "$@"
;;
composer)
dc exec "$SERVICE" composer "$@"
;;
npm|yarn|pnpm)
dc exec "$SERVICE" "$CMD" "$@"
;;
*)
# Fallback: beliebigen Befehl im Standard-Service ausführen
dc exec "$SERVICE" "$CMD" "$@"
;;
esac