Compare commits

..

2 Commits

Author SHA1 Message Date
527954befd fix database paht 2025-10-22 20:50:36 +02:00
e7d30151b7 copy database files manually 2025-10-22 20:30:08 +02:00
2 changed files with 13 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ COPY backend/src/ ./src/
# Build backend
RUN npm run build
# Copy database files manually (tsc doesn't copy non-TS files)
# Copy database files manually
RUN cp -r src/database/ dist/database/
# Verify Python and OR-Tools installation
@@ -56,6 +56,9 @@ WORKDIR /app
# Install PM2 for process management
RUN npm install -g pm2
# In der Production Stage, füge diese Zeile hinzu:
ENV DB_PATH=/app/data/schichtplan.db
# Copy backend built files
COPY --from=backend-builder /app/backend/package*.json ./
COPY --from=backend-builder /app/backend/dist/ ./dist/

View File

@@ -1,10 +1,18 @@
import sqlite3 from 'sqlite3';
import path from 'path';
import { fileURLToPath } from 'url';
import fs from 'fs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const dbPath = path.join(__dirname, '../../database/schichtplan.db');
const dbPath = process.env.DB_PATH || '/app/data/schichtplan.db';
// Stelle sicher, dass das Verzeichnis existiert
const dbDir = path.dirname(dbPath);
if (!fs.existsSync(dbDir)) {
fs.mkdirSync(dbDir, { recursive: true });
}
class Database {
private db: sqlite3.Database;