# Build stage: install dependencies and build the monorepo from source
FROM node:20-bullseye-slim AS build
WORKDIR /workspace
# Use Corepack to manage the specified PNPM version
RUN corepack enable && corepack prepare pnpm@9.2.0 --activate
# Copy the repository and install/build
COPY . .
RUN pnpm install
RUN pnpm build
# Runtime stage: include built artifacts
FROM node:20-slim AS runtime
WORKDIR /workspace
# Copy the built artifacts from the build stage
COPY --from=build /workspace /workspace
# Default to a shell so users can inspect or run commands
CMD ["bash"]