41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# docker-prep.sh — Prep NoteLett Docker consumers via the shared common-plat prep-consumer script.
|
|
# Usage:
|
|
# ./scripts/docker-prep.sh # prep backend + web for docker build
|
|
# ./scripts/docker-prep.sh --restore # restore package.json changes and remove .docker-deps
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
COMMON_PLAT="${REPO_ROOT}/../learning_ai_common_plat"
|
|
PREP_SCRIPT="${COMMON_PLAT}/scripts/prep-consumer.sh"
|
|
|
|
if [[ ! -f "$PREP_SCRIPT" ]]; then
|
|
echo "❌ Cannot find prep-consumer.sh at $PREP_SCRIPT"
|
|
exit 1
|
|
fi
|
|
|
|
CONSUMERS=(backend web)
|
|
MODE="${1:-}"
|
|
|
|
for consumer in "${CONSUMERS[@]}"; do
|
|
TARGET="${REPO_ROOT}/${consumer}"
|
|
if [[ ! -d "$TARGET" ]]; then
|
|
echo "⚠️ Skipping ${consumer} — directory not found"
|
|
continue
|
|
fi
|
|
|
|
if [[ "$MODE" == "--restore" ]]; then
|
|
bash "$PREP_SCRIPT" "$TARGET" --restore
|
|
else
|
|
bash "$PREP_SCRIPT" "$TARGET"
|
|
fi
|
|
done
|
|
|
|
if [[ "$MODE" != "--restore" ]]; then
|
|
echo ""
|
|
echo "✅ Docker prep complete. Run 'docker build' now, then restore with:"
|
|
echo " ./scripts/docker-prep.sh --restore"
|
|
fi
|