mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 527954befd | |||
| e7d30151b7 | |||
| 4a006a2e69 |
@@ -23,6 +23,9 @@ COPY backend/src/ ./src/
|
|||||||
# Build backend
|
# Build backend
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Copy database files manually
|
||||||
|
RUN cp -r src/database/ dist/database/
|
||||||
|
|
||||||
# Verify Python and OR-Tools installation
|
# Verify Python and OR-Tools installation
|
||||||
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
|
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
|
||||||
|
|
||||||
@@ -53,6 +56,9 @@ WORKDIR /app
|
|||||||
# Install PM2 for process management
|
# Install PM2 for process management
|
||||||
RUN npm install -g pm2
|
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 backend built files
|
||||||
COPY --from=backend-builder /app/backend/package*.json ./
|
COPY --from=backend-builder /app/backend/package*.json ./
|
||||||
COPY --from=backend-builder /app/backend/dist/ ./dist/
|
COPY --from=backend-builder /app/backend/dist/ ./dist/
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
import sqlite3 from 'sqlite3';
|
import sqlite3 from 'sqlite3';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
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 {
|
class Database {
|
||||||
private db: sqlite3.Database;
|
private db: sqlite3.Database;
|
||||||
|
|||||||
Reference in New Issue
Block a user