fixed monorepo package struct

This commit is contained in:
2025-10-25 00:41:09 +02:00
parent 8be6a7b474
commit 636b892ece
4 changed files with 2385 additions and 3078 deletions

View File

@@ -1,7 +1,7 @@
# Multi-stage build for combined frontend + backend
FROM node:20-bullseye AS backend-builder
WORKDIR /app/backend
WORKDIR /app
# Install Python + OR-Tools
RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
@@ -10,21 +10,22 @@ RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
# Create symlink so python3 is callable as python
RUN ln -sf /usr/bin/python3 /usr/bin/python
# Copy backend files
COPY backend/package*.json ./
COPY backend/tsconfig.json ./
# Copy ALL package files (root + backend)
COPY package*.json ./
COPY backend/package.json ./backend/
# Install backend dependencies
RUN npm ci
# Install dependencies using workspaces
RUN npm ci --workspace=backend
# Copy backend source
COPY backend/src/ ./src/
COPY backend/src/ ./backend/src/
COPY backend/tsconfig.json ./backend/
# Build backend
RUN npm run build
RUN npm run build --workspace=backend
# Copy database files manually
RUN cp -r src/database/ dist/database/
RUN cp -r backend/src/database/ backend/dist/database/
# Verify Python and OR-Tools installation
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
@@ -32,21 +33,22 @@ RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installe
# Frontend build stage
FROM node:20-bullseye AS frontend-builder
WORKDIR /app/frontend
WORKDIR /app
# Copy frontend files
COPY frontend/package*.json ./
COPY frontend/tsconfig.json ./
# Copy ALL package files (root + frontend)
COPY package*.json ./
COPY frontend/package.json ./frontend/
# Install frontend dependencies
RUN npm ci
# Install dependencies using workspaces
RUN npm ci --workspace=frontend
# Copy frontend source
COPY frontend/src/ ./src/
COPY frontend/public/ ./public/
COPY frontend/src/ ./frontend/src/
COPY frontend/public/ ./frontend/public/
COPY frontend/tsconfig.json ./frontend/
# Build frontend
RUN npm run build
RUN npm run build --workspace=frontend
# Production stage
FROM node:20-bookworm
@@ -60,9 +62,9 @@ RUN npm install -g pm2
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/
COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/
COPY --from=backend-builder /app/backend/package.json ./
# Copy frontend built files
COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/