mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-11-30 22:45:46 +01:00
changed from workspace build to independet build
This commit is contained in:
42
Dockerfile
42
Dockerfile
@@ -1,7 +1,7 @@
|
|||||||
# Multi-stage build for combined frontend + backend
|
# Multi-stage build for combined frontend + backend
|
||||||
FROM node:20-bullseye AS backend-builder
|
FROM node:20-bullseye AS backend-builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app/backend
|
||||||
|
|
||||||
# Install Python + OR-Tools
|
# Install Python + OR-Tools
|
||||||
RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
|
RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
|
||||||
@@ -10,22 +10,21 @@ RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
|
|||||||
# Create symlink so python3 is callable as python
|
# Create symlink so python3 is callable as python
|
||||||
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
# Copy ALL package files (root + backend)
|
# Copy backend files
|
||||||
COPY package*.json ./
|
COPY backend/package*.json ./
|
||||||
COPY backend/package.json ./backend/
|
COPY backend/tsconfig.json ./
|
||||||
|
|
||||||
# Install dependencies using workspaces
|
# Install backend dependencies
|
||||||
RUN npm ci --workspace=backend
|
RUN npm ci
|
||||||
|
|
||||||
# Copy backend source
|
# Copy backend source
|
||||||
COPY backend/src/ ./backend/src/
|
COPY backend/src/ ./src/
|
||||||
COPY backend/tsconfig.json ./backend/
|
|
||||||
|
|
||||||
# Build backend
|
# Build backend
|
||||||
RUN npm run build --workspace=backend
|
RUN npm run build
|
||||||
|
|
||||||
# Copy database files manually
|
# Copy database files manually
|
||||||
RUN cp -r backend/src/database/ backend/dist/database/
|
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')"
|
||||||
@@ -33,22 +32,21 @@ RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installe
|
|||||||
# Frontend build stage
|
# Frontend build stage
|
||||||
FROM node:20-bullseye AS frontend-builder
|
FROM node:20-bullseye AS frontend-builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
# Copy ALL package files (root + frontend)
|
# Copy frontend files
|
||||||
COPY package*.json ./
|
COPY frontend/package*.json ./
|
||||||
COPY frontend/package.json ./frontend/
|
COPY frontend/tsconfig.json ./
|
||||||
|
|
||||||
# Install dependencies using workspaces
|
# Install frontend dependencies
|
||||||
RUN npm ci --workspace=frontend
|
RUN npm ci
|
||||||
|
|
||||||
# Copy frontend source
|
# Copy frontend source
|
||||||
COPY frontend/src/ ./frontend/src/
|
COPY frontend/src/ ./src/
|
||||||
COPY frontend/public/ ./frontend/public/
|
COPY frontend/public/ ./public/
|
||||||
COPY frontend/tsconfig.json ./frontend/
|
|
||||||
|
|
||||||
# Build frontend
|
# Build frontend
|
||||||
RUN npm run build --workspace=frontend
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM node:20-bookworm
|
FROM node:20-bookworm
|
||||||
@@ -62,9 +60,9 @@ RUN npm install -g pm2
|
|||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
# Copy backend built files
|
# 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/dist/ ./dist/
|
||||||
COPY --from=backend-builder /app/node_modules/ ./node_modules/
|
COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/
|
||||||
COPY --from=backend-builder /app/backend/package.json ./
|
|
||||||
|
|
||||||
# Copy frontend built files
|
# Copy frontend built files
|
||||||
COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/
|
COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/
|
||||||
|
|||||||
Reference in New Issue
Block a user