mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-11-30 22:45:46 +01:00
using npm install instead of npm ci
This commit is contained in:
4
.github/workflows/docker.yml
vendored
4
.github/workflows/docker.yml
vendored
@@ -78,9 +78,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install backend dependencies
|
- name: Install backend dependencies
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
run: |
|
run: npm install
|
||||||
# Try npm ci first, if it fails use npm install
|
|
||||||
npm ci || (echo "package-lock.json out of sync, using npm install..." && npm install)
|
|
||||||
|
|
||||||
- name: Run TypeScript check
|
- name: Run TypeScript check
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
|
|||||||
21
Dockerfile
21
Dockerfile
@@ -13,10 +13,10 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python
|
|||||||
# Copy all files
|
# Copy all files
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Install all dependencies (workspaces)
|
# Use npm install instead of npm ci to avoid the bug
|
||||||
RUN npm ci
|
RUN npm install
|
||||||
|
|
||||||
# Build backend
|
# Build backend first
|
||||||
RUN npm run build --workspace=backend
|
RUN npm run build --workspace=backend
|
||||||
|
|
||||||
# Build frontend
|
# Build frontend
|
||||||
@@ -25,42 +25,29 @@ RUN npm run build --workspace=frontend
|
|||||||
# 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')"
|
||||||
|
|
||||||
# Production stage
|
# Production stage - same as above
|
||||||
FROM node:20-bookworm
|
FROM node:20-bookworm
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install PM2 for process management
|
|
||||||
RUN npm install -g pm2
|
RUN npm install -g pm2
|
||||||
|
|
||||||
# Create data directory for SQLite database with proper permissions
|
|
||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
# Copy backend built files
|
|
||||||
COPY --from=builder /app/backend/dist/ ./dist/
|
COPY --from=builder /app/backend/dist/ ./dist/
|
||||||
COPY --from=builder /app/backend/package*.json ./
|
COPY --from=builder /app/backend/package*.json ./
|
||||||
|
|
||||||
# Copy only production dependencies
|
|
||||||
COPY --from=builder /app/node_modules/ ./node_modules/
|
COPY --from=builder /app/node_modules/ ./node_modules/
|
||||||
|
|
||||||
# Copy frontend built files
|
|
||||||
COPY --from=builder /app/frontend/dist/ ./frontend-build/
|
COPY --from=builder /app/frontend/dist/ ./frontend-build/
|
||||||
|
|
||||||
# Copy PM2 configuration
|
|
||||||
COPY --from=builder /app/ecosystem.config.cjs ./
|
COPY --from=builder /app/ecosystem.config.cjs ./
|
||||||
|
|
||||||
# Create a non-root user and group - DEBIAN STYLE
|
|
||||||
RUN groupadd -g 1001 nodejs && \
|
RUN groupadd -g 1001 nodejs && \
|
||||||
useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \
|
useradd -m -u 1001 -s /bin/bash -g nodejs schichtplan && \
|
||||||
chown -R schichtplan:nodejs /app && \
|
chown -R schichtplan:nodejs /app && \
|
||||||
chmod 755 /app && \
|
chmod 755 /app && \
|
||||||
chmod 775 /app/data
|
chmod 775 /app/data
|
||||||
|
|
||||||
# Set PM2 to use app directory instead of home directory
|
|
||||||
ENV PM2_HOME=/app/.pm2
|
ENV PM2_HOME=/app/.pm2
|
||||||
|
|
||||||
USER schichtplan
|
USER schichtplan
|
||||||
|
|
||||||
EXPOSE 3002
|
EXPOSE 3002
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||||
|
|||||||
Reference in New Issue
Block a user