chore(docker): .dockerignore angepasst; lokale Build-Schritte in Rebuild-Skripten; Doku/README zu production vs production-prebuilt aktualisiert

This commit is contained in:
2025-10-06 18:59:17 +02:00
parent 7a84130aec
commit 1124b1f40b
24 changed files with 1149 additions and 270 deletions

View File

@@ -1,6 +1,29 @@
@echo off
docker compose -f docker-compose.yml down
if errorlevel 1 exit /b 1
git pull
if errorlevel 1 exit /b 1
echo Building application locally...
pnpm install --frozen-lockfile
if errorlevel 1 exit /b 1
pnpm run build
if errorlevel 1 exit /b 1
docker compose -f docker-compose.yml build
if errorlevel 1 exit /b 1
docker compose -f docker-compose.yml up -d
if errorlevel 1 exit /b 1
echo Waiting for container to start...
@timeout /t 5 /nobreak >nul
echo Verifying bcrypt installation in container...
docker compose -f docker-compose.yml exec stargirlnails node -e "require('bcrypt')" && echo bcrypt OK || echo bcrypt FAILED
if errorlevel 1 exit /b 1
docker compose -f docker-compose.yml logs -f stargirlnails

View File

@@ -1,5 +1,17 @@
#! /bin/bash
set -e
# Exit on error to catch build failures early
docker compose -f docker-compose.yml down
echo "Building application locally..."
pnpm install --frozen-lockfile || exit 1
pnpm run build || exit 1
docker compose -f docker-compose.yml build --no-cache
docker compose -f docker-compose.yml up -d
# docker compose -f docker-compose.yml logs -f stargirlnails
echo "Waiting for container to start..."
sleep 5
echo "Verifying bcrypt installation in container..."
docker compose -f docker-compose.yml exec stargirlnails node -e "require('bcrypt')" && echo "✓ bcrypt OK" || echo "✗ bcrypt FAILED"

View File

@@ -20,7 +20,15 @@ echo "[3/7] Pull base images (e.g., caddy)"
sudo docker compose -f "$COMPOSE_FILE" pull || true
echo "[4/7] Build application image without cache"
# Falls docker-compose-prod.yml den target 'production-prebuilt' nutzt, vorher lokal bauen
if grep -q "target:\s*production-prebuilt" "$COMPOSE_FILE" 2>/dev/null; then
echo "Detected target production-prebuilt in $COMPOSE_FILE - building locally first..."
pnpm install --frozen-lockfile --prod || exit 1
pnpm run build || exit 1
fi
sudo docker compose -f "$COMPOSE_FILE" build --no-cache
echo "Build completed successfully. Native modules compiled for Alpine Linux."
echo "[5/7] Start services in background"
sudo docker compose -f "$COMPOSE_FILE" up -d
@@ -54,6 +62,9 @@ for i in {1..12}; do
sleep 5
done
echo "[6c/7] Verifying bcrypt installation in production container..."
sudo docker compose -f "$COMPOSE_FILE" exec stargirlnails node -e "require('bcrypt')" && echo "✓ bcrypt OK" || echo "✗ bcrypt FAILED"
echo "[7/7] Tail recent logs for app and caddy (press Ctrl+C to exit)"
sudo docker compose -f "$COMPOSE_FILE" logs --since=10m -f stargirlnails &
APP_LOG_PID=$!