# Build stage
FROM node:18-alpine AS build
WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

# Runtime stage
FROM node:18-alpine
WORKDIR /app

# Install static file server
RUN npm install -g serve

# Copy build output only
COPY --from=build /app/dist ./dist

EXPOSE 3002
CMD ["serve", "-s", "dist", "-l", "3002"]
