# ==========================================
# dashboard/Dockerfile (Production)
# ==========================================

FROM node:20-alpine AS build
WORKDIR /app

# Kopiere package.json und Lockfile aus dem Build-Kontext (./dashboard)
COPY package*.json ./

# Produktions-Abhängigkeiten installieren
ENV NODE_ENV=production
RUN npm ci --omit=dev

# Quellcode kopieren und builden
COPY . .
ARG VITE_API_URL
ENV VITE_API_URL=${VITE_API_URL}
RUN npm run build

FROM nginx:1.25-alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", " -g", "daemon off;"]

