Compare commits

..

4 Commits

3 changed files with 9 additions and 10 deletions

View File

@@ -113,6 +113,7 @@ jobs:
permissions: permissions:
contents: write contents: write
packages: write packages: write
id-token: write
steps: steps:
- name: Checkout code - name: Checkout code

View File

@@ -5,7 +5,7 @@ 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 \
&& pip install --no-cache-dir ortools && pip install --no-cache-dir ortools
# 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
@@ -27,9 +27,6 @@ RUN npm run build
# 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
@@ -73,12 +70,12 @@ COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/
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 && \
adduser -S schichtplan -u 1001 && \ adduser -S schichtplan -u 1001 && \
chown -R schichtplan:nodejs /app chown -R schichtplan:nodejs /app
USER schichtplan USER schichtplan
@@ -91,4 +88,4 @@ 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: [
{ {
@@ -14,7 +15,7 @@ module.exports = {
time: true time: true
}, },
{ {
name: 'frontend', name: 'frontend',
script: 'npx', script: 'npx',
args: 'serve -s frontend-build -l 3000', args: 'serve -s frontend-build -l 3000',
instances: 1, instances: 1,
@@ -23,7 +24,7 @@ module.exports = {
NODE_ENV: 'production' NODE_ENV: 'production'
}, },
error_file: './logs/frontend-err.log', error_file: './logs/frontend-err.log',
out_file: './logs/frontend-out.log', out_file: './logs/frontend-out.log',
time: true time: true
} }
] ]