FROM node:22-alpine
WORKDIR /app

COPY backend/package*.json ./backend/
COPY prisma ./prisma

WORKDIR /app/backend
RUN npm ci

COPY backend ./
RUN npx prisma generate --schema ../prisma/schema.prisma
RUN npm run build

EXPOSE 3001
CMD ["npm", "run", "start:prod"]
