FROM node:20-bookworm

WORKDIR /app

RUN corepack enable && corepack prepare npm@10.5.0 --activate

COPY package.json package-lock.json turbo.json tsconfig.base.json ./
COPY apps ./apps
COPY packages ./packages

RUN npm install

ENV NODE_ENV=test

CMD ["sh", "-c", "npm run db:deploy && npm run db:generate && npm run type-check && npm run build && npm run test:api:integration"]
