mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 017f5fb2e0 | |||
| 527954befd | |||
| e7d30151b7 | |||
| 4a006a2e69 |
14
Dockerfile
14
Dockerfile
@@ -23,6 +23,9 @@ COPY backend/src/ ./src/
|
||||
# Build backend
|
||||
RUN npm run build
|
||||
|
||||
# Copy database files manually
|
||||
RUN cp -r src/database/ dist/database/
|
||||
|
||||
# Verify Python and OR-Tools installation
|
||||
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
|
||||
RUN npm install -g pm2
|
||||
|
||||
# Create data directory for SQLite database with proper permissions
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# Copy backend built files
|
||||
COPY --from=backend-builder /app/backend/package*.json ./
|
||||
COPY --from=backend-builder /app/backend/dist/ ./dist/
|
||||
@@ -64,10 +70,12 @@ COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/
|
||||
# Copy PM2 configuration
|
||||
COPY ecosystem.config.cjs ./
|
||||
|
||||
# Create a non-root user
|
||||
# Create a non-root user and group
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S schichtplan -u 1001 && \
|
||||
chown -R schichtplan:nodejs /app
|
||||
adduser -S schichtplan -u 1001 -G nodejs && \
|
||||
chown -R schichtplan:nodejs /app && \
|
||||
chmod 755 /app && \
|
||||
chmod 775 /app/data
|
||||
|
||||
USER schichtplan
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user