FROM node:22-slim AS frontend
WORKDIR /app/web
COPY web/package.json ./
RUN npm install
COPY web/ ./
RUN npm run build

FROM node:22-slim AS production
WORKDIR /app

COPY server/package.json ./server/
WORKDIR /app/server
RUN npm install --omit=dev

COPY server/ ./
COPY --from=frontend /app/web/dist /app/web/dist

EXPOSE 3456

CMD ["npx", "tsx", "src/index.ts"]
