FROM node:20-slim AS base ENV CI=true ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable WORKDIR /app COPY package.json pnpm-lock.yaml ./ FROM base AS prod-deps RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod FROM base AS build RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install COPY . /app RUN pnpm run build FROM base ENV NODE_ENV=production COPY --from=prod-deps /app/node_modules /app/node_modules COPY --from=build /app/dist /app/dist COPY --from=build /app/templates /app/templates EXPOSE 8000 CMD [ "pnpm", "start" ]