FROM node:22-alpine AS frontend-build

WORKDIR /app

COPY frontend/package.json ./
RUN npm install

COPY frontend/index.html frontend/vite.config.ts frontend/tsconfig.json frontend/tsconfig.app.json ./
COPY frontend/src ./src

RUN npm run build

FROM nginx:1.27-alpine

COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=frontend-build /app/dist /usr/share/nginx/html
