# Build stage
FROM node:22-alpine AS build

# Update packages for security
RUN apk update && apk upgrade --no-cache

WORKDIR /app
COPY package*.json ./
RUN npm install --frozen-lockfile || npm install
COPY . .
RUN npm run build

# Production stage
FROM nginx:alpine

# Update packages for security
RUN apk update && apk upgrade --no-cache

COPY --from=build /app/dist /usr/share/nginx/html
# Nginx default listen 80
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
