zkt26/z1/prepare-app.sh
2026-04-01 10:00:23 +02:00

37 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# ============================================================
# prepare-app.sh Build images, create network & volumes
# ============================================================
set -euo pipefail
echo "╔══════════════════════════════════════════════╗"
echo "║ NitheeshWork Prepare Application ║"
echo "╚══════════════════════════════════════════════╝"
cd "$(dirname "$0")"
# ── 1. Docker network ────────────────────────────────────────
echo ""
echo "▸ Creating Docker network: nitheeshwork-net"
docker network inspect nitheeshwork-net >/dev/null 2>&1 \
&& echo " Network already exists, skipping." \
|| docker network create nitheeshwork-net
# ── 2. Named volumes ─────────────────────────────────────────
echo ""
echo "▸ Creating named volumes…"
for vol in nitheeshwork-postgres-data nitheeshwork-redis-data nitheeshwork-pgadmin-data; do
docker volume inspect "$vol" >/dev/null 2>&1 \
&& echo " Volume $vol already exists, skipping." \
|| docker volume create "$vol" && echo " Created: $vol"
done
# ── 3. Build backend image ───────────────────────────────────
echo ""
echo "▸ Building backend Docker image…"
docker build -t nitheeshwork-backend:latest ./backend
echo ""
echo "✔ Preparation complete."
echo " Run ./start-app.sh to start all services."