From b35a66cd8aeaee99d0d2d78ae5bc24d3f1383eae Mon Sep 17 00:00:00 2001 From: Till Tomczak Date: Mon, 31 Mar 2025 16:18:47 +0200 Subject: [PATCH] Behebe Frontend-Build und Datenbankmigrationen im Docker-Container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Füge pnpm build zum Dockerfile hinzu, um das fehlende .next-Verzeichnis zu erstellen - Ersetze problematische drizzle-kit CLI-Befehle durch direkte Node.js-Implementation - Verwende CommonJS-require statt ES-Module für bessere Kompatibilität - Verbessere Fehlerbehandlung während der Datenbankmigrationen 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- packages/reservation-platform/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/reservation-platform/Dockerfile b/packages/reservation-platform/Dockerfile index fc91214..21b5834 100644 --- a/packages/reservation-platform/Dockerfile +++ b/packages/reservation-platform/Dockerfile @@ -24,6 +24,9 @@ COPY . . # Create database directory RUN mkdir -p db/ +# Build the Next.js application +RUN pnpm build + # Expose the port EXPOSE 3000 @@ -33,8 +36,8 @@ RUN echo '#!/bin/sh' > /app/startup.sh && \ echo 'mkdir -p /app/db' >> /app/startup.sh && \ echo 'echo "Starting application..."' >> /app/startup.sh && \ echo 'echo "Attempting database migration..."' >> /app/startup.sh && \ - echo 'npx drizzle-kit generate --schema=./src/server/db/schema.ts || echo "Generate schema failed, but continuing..."' >> /app/startup.sh && \ - echo 'npx drizzle-kit push:sqlite || echo "Push migration failed, but continuing..."' >> /app/startup.sh && \ + echo 'NODE_ENV=production node -e "const { migrate } = require(\"drizzle-orm/better-sqlite3/migrator\"); const { db } = require(\"./src/server/db/index.js\"); try { console.log(\"Running migrations...\"); migrate(db, { migrationsFolder: \"./drizzle\" }); console.log(\"Migrations completed\"); } catch(e) { console.error(\"Migration error:\", e); }"' >> /app/startup.sh && \ + echo 'echo "Migration completed or skipped"' >> /app/startup.sh && \ echo 'pnpm start' >> /app/startup.sh && \ chmod +x /app/startup.sh