FROM node:22-slim AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable FROM base AS build COPY . /usr/src/app WORKDIR /usr/src/app RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN pnpm run -r build RUN pnpm deploy --filter=backend --prod /prod/backend RUN pnpm deploy --filter=frontend --prod /prod/frontend FROM base AS backend COPY --from=build /prod/backend /usr/src/app WORKDIR /usr/src/app EXPOSE 3001 CMD ["pnpm", "start"] FROM base AS frontend COPY --from=build /prod/frontend /usr/src/app WORKDIR /usr/src/app EXPOSE 3000 CMD ["pnpm", "start"]