FROM node:22-alpine AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable FROM base AS deps # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. RUN apk add --no-cache libc6-compat COPY . /usr/src/app WORKDIR /usr/src/app RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile FROM base AS builder-frontend COPY --from=deps /usr/src/app /usr/src/app RUN pnpm deploy --target frontend FROM node:22-alpine AS frontend WORKDIR /app COPY --from=base-build /prod/frontend/.next ./.next COPY --from=base-build /usr/src/app/apps/frontend/public ./.next/standalone/public ENV NODE_ENV=production EXPOSE 3000 CMD ["node", ".next/standalone/server.js"]