Compare commits

..

13 Commits

3 changed files with 19 additions and 29 deletions

View File

@@ -1,10 +1,10 @@
name: CI/CD Pipeline name: CI/CD Pipeline
on: on:
workflow_dispatch:
push: push:
branches: [ main, master, development ] branches: [ "development", "main", "staging" ]
pull_request: tags: [ "v*.*.*" ]
branches: [ main, master, development ]
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
@@ -110,8 +110,9 @@ jobs:
if: github.event_name == 'push' if: github.event_name == 'push'
permissions: permissions:
contents: read contents: write
packages: write packages: write
id-token: write
steps: steps:
- name: Checkout code - name: Checkout code
@@ -163,7 +164,7 @@ jobs:
- name: Display pushed images - name: Display pushed images
run: | run: |
echo "Docker images pushed successfully!" echo "Docker images pushed successfully!"
echo "📦 Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" echo "- Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
echo "🏷️ Tags: ${{ steps.meta.outputs.tags }}" echo "- Tags: ${{ steps.meta.outputs.tags }}"
echo "🚀 New version: ${{ needs.set-tag.outputs.tag_name }}" echo "- New version: ${{ needs.set-tag.outputs.tag_name }}"

View File

@@ -23,13 +23,12 @@ COPY backend/src/ ./src/
# Build backend # Build backend
RUN npm run build RUN npm run build
# Copy database files manually (tsc doesn't copy non-TS files)
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')"
#RUN python3 -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
# Frontend build stage # Frontend build stage
FROM node:20-bullseye AS frontend-builder FROM node:20-bullseye AS frontend-builder
@@ -54,12 +53,6 @@ FROM node:20-alpine
WORKDIR /app WORKDIR /app
# Install Python and OR-Tools for production
#RUN apk add --no-cache \
# python \
# py3-pip \
# && pip3 install ortools
# Install PM2 for process management # Install PM2 for process management
RUN npm install -g pm2 RUN npm install -g pm2
@@ -67,13 +60,12 @@ RUN npm install -g pm2
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/
COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/ COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/
# COPY --from=backend-builder /app/backend/python-scripts/ ./python-scripts/
# 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/
# Copy PM2 configuration # Copy PM2 configuration
COPY ecosystem.config.js ./ COPY ecosystem.config.cjs ./
# Create a non-root user # Create a non-root user
RUN addgroup -g 1001 -S nodejs && \ RUN addgroup -g 1001 -S nodejs && \
@@ -82,13 +74,9 @@ RUN addgroup -g 1001 -S nodejs && \
USER schichtplan USER schichtplan
# Verify installations
#RUN python --version && \
# python -c "from ortools.sat.python import cp_model; print('OR-Tools verified')"
EXPOSE 3000 3002 EXPOSE 3000 3002
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3002/api/health || exit 1 CMD wget --no-verbose --tries=1 --spider http://localhost:3002/api/health || exit 1
CMD ["pm2-runtime", "ecosystem.config.js"] CMD ["pm2-runtime", "ecosystem.config.cjs"]

View File

@@ -1,3 +1,4 @@
// ecosystem.config.cjs
module.exports = { module.exports = {
apps: [ apps: [
{ {