# Multi-stage build: compile Vue frontend, serve with nginx
# Stage 1: Build the frontend
FROM node:22-alpine AS builder

WORKDIR /build

# Cache dependencies — copy manifests first
COPY package.json package-lock.json* ./
RUN npm install

# Copy source and build
COPY . .
RUN npm run build

# Stage 2: Serve with nginx
FROM nginx:alpine

# Copy built frontend
COPY --from=builder /build/dist /usr/share/nginx/html

EXPOSE 80
