Files
infoscreen/dashboard/Dockerfile
olaf 4e74f72c9f multiple corrections on docker-compose and Dockerfile
robust start sequence
avoid scrolling of main content
2025-08-31 07:30:53 +00:00

53 lines
1.4 KiB
Docker

# ==========================================
# dashboard/Dockerfile (Production)
# 🔧 OPTIMIERT: Multi-Stage-Build für ein minimales Produktions-Image
# ==========================================
# Stage 1: Build-Umgebung
FROM node:20-alpine AS build
WORKDIR /app
# Kopiere package.json und pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# 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
# Kopiere den restlichen Quellcode
COPY . .
# Setze Build-Argumente als Umgebungsvariablen
ARG VITE_API_URL
ENV VITE_API_URL=${VITE_API_URL}
# Baue die Anwendung für die Produktion
RUN pnpm build
# Stage 2: Produktions-Umgebung
FROM nginx:1.25-alpine
# Kopiere die gebauten statischen Dateien aus der Build-Stage
COPY --from=build /app/dist /usr/share/nginx/html
# 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
# Exponiere Port 80 (Standard-HTTP-Port von Nginx)
EXPOSE 80
# Starte Nginx
CMD ["nginx", "-g", "daemon off;"]