FROM node:25.6.1 AS production

RUN npm i -g pnpm

WORKDIR /app

COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./

COPY apps/orchestrator/package.json ./apps/orchestrator/package.json

COPY packages ./packages

RUN pnpm install

COPY apps/orchestrator ./apps/orchestrator

RUN pnpm install

RUN pnpm run build

COPY scripts/prod.start.sh ./scripts/prod.start.sh

EXPOSE 3000

RUN chmod +x scripts/prod.start.sh

CMD ["/bin/sh", "scripts/prod.start.sh", "apps/orchestrator"]
