FROM node:20-alpine AS builder
WORKDIR /app

COPY client/package.json client/
RUN cd client && npm install
COPY client client
RUN cd client && npm run build

FROM node:20-alpine
WORKDIR /app

COPY package.json .
RUN npm install
COPY server server
COPY --from=builder /app/client/dist client/dist

EXPOSE 4000
CMD ["npm", "start"]
