fix: ensure user-template-next is always built for multi-container MVP

The install.sh script was only building user-template-next when
USER_TEMPLATE_IMAGE=user-template-next:latest was set in .env, which
was an old single-container configuration.

Changes:
- Remove dependency on USER_TEMPLATE_IMAGE for building user-template-next
- Always build user-template-next when directory exists
- Add user-template-next to TOTAL_BUILDS count automatically
- Change user-template-next build from optional warning to required
- Update build output to clearly show multi-container template building
- Update final installation summary to show template configuration

This ensures both dev and prod templates are always built for the
Multi-Container MVP, regardless of legacy .env settings.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
XPS\Micro 2026-01-31 21:22:09 +01:00
parent 2bcb7b97a4
commit 5cfad38b3c

View File

@ -375,15 +375,22 @@ fi
# 7. Docker-Images bauen # 7. Docker-Images bauen
# ============================================================ # ============================================================
echo "" echo ""
echo "Baue Docker-Images..." echo "Baue Docker-Images fuer Multi-Container MVP..."
echo " - user-service-template (Development)"
echo " - user-template-next (Production)"
echo " - spawner-api (Backend)"
echo " - spawner-frontend (Frontend)"
echo ""
# Stoppe laufende Container # Stoppe laufende Container
${COMPOSE_CMD} down 2>/dev/null || true ${COMPOSE_CMD} down 2>/dev/null || true
# Zaehle aktive Builds fuer Fortschrittsanzeige # Zaehle aktive Builds fuer Fortschrittsanzeige
BUILD_STEP=1 BUILD_STEP=1
TOTAL_BUILDS=3 # user-service-template + spawner-api + frontend (optional: + user-template-next) TOTAL_BUILDS=3 # user-service-template + spawner-api + frontend
[ "$USER_TEMPLATE_IMAGE" = "user-template-next:latest" ] && [ -d "${INSTALL_DIR}/user-template-next" ] && TOTAL_BUILDS=$((TOTAL_BUILDS + 1))
# Multi-Container Support: Baue auch user-template-next wenn Verzeichnis existiert
[ -d "${INSTALL_DIR}/user-template-next" ] && TOTAL_BUILDS=$((TOTAL_BUILDS + 1))
# User-Template Image bauen (fuer User-Container) # User-Template Image bauen (fuer User-Container)
if [ -d "${INSTALL_DIR}/user-template" ]; then if [ -d "${INSTALL_DIR}/user-template" ]; then
@ -415,10 +422,10 @@ if [ -d "${INSTALL_DIR}/user-template" ]; then
BUILD_STEP=$((BUILD_STEP + 1)) BUILD_STEP=$((BUILD_STEP + 1))
fi fi
# User-Template-Next Image bauen (alternatives Template, OPTIONAL) # User-Template-Next Image bauen (Production Template fuer Multi-Container MVP)
# Wird NUR gebaut wenn USER_TEMPLATE_IMAGE=user-template-next:latest in .env gesetzt ist # Wird automatisch gebaut wenn Verzeichnis existiert
if [ "$USER_TEMPLATE_IMAGE" = "user-template-next:latest" ] && [ -d "${INSTALL_DIR}/user-template-next" ]; then if [ -d "${INSTALL_DIR}/user-template-next" ]; then
echo " [$BUILD_STEP/$TOTAL_BUILDS] Baue user-template-next (Next.js Template, Optional)..." echo " [$BUILD_STEP/$TOTAL_BUILDS] Baue user-template-next (Next.js Template - Production)..."
echo -e " ${BLUE}Dies kann 2-5 Minuten dauern (npm install + build)...${NC}" echo -e " ${BLUE}Dies kann 2-5 Minuten dauern (npm install + build)...${NC}"
echo "" echo ""
@ -435,14 +442,13 @@ if [ "$USER_TEMPLATE_IMAGE" = "user-template-next:latest" ] && [ -d "${INSTALL_D
echo -e " user-template-next: ${GREEN}OK${NC}" echo -e " user-template-next: ${GREEN}OK${NC}"
else else
echo "" echo ""
echo -e " user-template-next: ${YELLOW}WARNUNG - Build fehlgeschlagen (optional)${NC}" echo -e " user-template-next: ${RED}FEHLER${NC}"
echo " Siehe Build-Log: ${LOG_FILE}"
echo " Letzte 50 Zeilen:"
tail -50 "${BUILD_LOG}"
exit 1
fi fi
BUILD_STEP=$((BUILD_STEP + 1)) BUILD_STEP=$((BUILD_STEP + 1))
elif [ -d "${INSTALL_DIR}/user-template-next" ]; then
echo " [⊙] Überspringe user-template-next (nicht aktiviert in .env)"
echo -e " ${BLUE}Um Next.js Template zu aktivieren, setze in .env:${NC}"
echo " USER_TEMPLATE_IMAGE=user-template-next:latest"
echo ""
fi fi
# Spawner Backend Image bauen # Spawner Backend Image bauen
@ -561,8 +567,17 @@ echo " Logs FE: ${COMPOSE_CMD} logs -f frontend"
echo " Neustart: ${COMPOSE_CMD} restart" echo " Neustart: ${COMPOSE_CMD} restart"
echo " Stoppen: ${COMPOSE_CMD} down" echo " Stoppen: ${COMPOSE_CMD} down"
echo "" echo ""
echo "WICHTIG - Multi-Container MVP:"
echo " - Jeder User erhält 2 Container: Development und Production"
echo " - Dev Container: https://${SPAWNER_SUBDOMAIN}.${BASE_DOMAIN}/{slug}-dev"
echo " - Prod Container: https://${SPAWNER_SUBDOMAIN}.${BASE_DOMAIN}/{slug}-prod"
echo ""
echo "WICHTIG - Passwordless Auth:" echo "WICHTIG - Passwordless Auth:"
echo " Das System nutzt Magic Links (Email-basiert)!" echo " Das System nutzt Magic Links (Email-basiert)!"
echo " - SMTP konfigurieren: .env Datei anpassen" echo " - SMTP konfigurieren: .env Datei anpassen"
echo " - Datenbank wird automatisch mit allen Tabellen erstellt" echo " - Datenbank wird automatisch mit allen Tabellen erstellt"
echo "" echo ""
echo "Template Configuration (.env):"
echo " USER_TEMPLATE_IMAGE_DEV=user-service-template:latest"
echo " USER_TEMPLATE_IMAGE_PROD=user-template-next:latest"
echo ""