multiple corrections on docker-compose and Dockerfile

robust start sequence
avoid scrolling of main content
This commit is contained in:
2025-08-31 07:30:53 +00:00
parent 2ca5f0060e
commit 4e74f72c9f
11 changed files with 211 additions and 118 deletions

View File

@@ -1,39 +1,52 @@
# ==========================================
# dashboard/Dockerfile (Production)
# 🔧 OPTIMIERT: Multi-Stage-Build für ein minimales Produktions-Image
# ==========================================
FROM node:lts-alpine AS builder
# Stage 1: Build-Umgebung
FROM node:20-alpine AS build
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY pnpm-lock.yaml* ./
# Kopiere package.json und pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install pnpm and dependencies
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
# Installiere pnpm und dann die Abhängigkeiten
# --prod stellt sicher, dass nur Produktions-Abhängigkeiten installiert werden
RUN npm install -g pnpm && pnpm install --prod --frozen-lockfile
# Copy source code
# Kopiere den restlichen Quellcode
COPY . .
# Build arguments
ARG NODE_ENV=production
# Setze Build-Argumente als Umgebungsvariablen
ARG VITE_API_URL
ENV VITE_API_URL=${VITE_API_URL}
# Build the application
# Baue die Anwendung für die Produktion
RUN pnpm build
# Production stage with nginx
FROM nginx:alpine
# Stage 2: Produktions-Umgebung
FROM nginx:1.25-alpine
# Copy built files to nginx
COPY --from=builder /app/dist /usr/share/nginx/html
# Kopiere die gebauten statischen Dateien aus der Build-Stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy custom nginx config (optional)
COPY nginx.conf /etc/nginx/nginx.conf
# Optional: Eine Nginx-Konfiguration für Single-Page-Applications (SPA)
# Diese leitet alle Anfragen, die keine Dateien sind, auf die index.html um.
# Erstelle eine Datei `nginx.prod.conf` mit folgendem Inhalt:
# server {
# listen 80;
# root /usr/share/nginx/html;
# index index.html;
# location / {
# try_files $uri $uri/ /index.html;
# }
# }
# COPY nginx.prod.conf /etc/nginx/conf.d/default.conf
# Expose port
EXPOSE 3000
# Exponiere Port 80 (Standard-HTTP-Port von Nginx)
EXPOSE 80
# Start nginx
# Starte Nginx
CMD ["nginx", "-g", "daemon off;"]