mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-11-30 22:45:46 +01:00
cp running
This commit is contained in:
61
backend/dockerfilexpython
Normal file
61
backend/dockerfilexpython
Normal file
@@ -0,0 +1,61 @@
|
||||
# Multi-stage Dockerfile for Node.js + Python application
|
||||
FROM node:20-alpine AS node-base
|
||||
|
||||
# Install Python and build dependencies in Node stage
|
||||
RUN apk add --no-cache \
|
||||
python3 \
|
||||
py3-pip \
|
||||
build-base \
|
||||
python3-dev
|
||||
|
||||
# Install Python dependencies
|
||||
COPY python-scripts/requirements.txt /tmp/requirements.txt
|
||||
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install Node.js dependencies
|
||||
RUN npm ci --only=production
|
||||
|
||||
# Build stage
|
||||
FROM node-base AS builder
|
||||
|
||||
# Install all dependencies (including dev dependencies)
|
||||
RUN npm ci
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM node-base AS production
|
||||
|
||||
# Copy built application from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=builder /app/package*.json ./
|
||||
|
||||
# Copy Python scripts
|
||||
COPY --from=builder /app/python-scripts ./python-scripts
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S nextjs -u 1001
|
||||
|
||||
# Change to non-root user
|
||||
USER nextjs
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD node dist/health-check.js
|
||||
|
||||
# Start the application
|
||||
CMD ["npm", "start"]
|
||||
Reference in New Issue
Block a user