FROM node:20-alpine AS base RUN corepack enable && corepack prepare pnpm@9.12.0 --activate WORKDIR /app FROM base AS deps COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./ COPY apps/edr-freight-api/package.json ./apps/edr-freight-api/ COPY packages ./packages RUN pnpm install --frozen-lockfile --filter @edr/freight-api... FROM deps AS build COPY apps/edr-freight-api ./apps/edr-freight-api RUN pnpm --filter @edr/freight-api build FROM node:20-alpine AS runtime RUN corepack enable && corepack prepare pnpm@9.12.0 --activate WORKDIR /app/apps/edr-freight-api ENV NODE_ENV=production COPY --from=deps /app/node_modules ./../../node_modules COPY --from=deps /app/apps/edr-freight-api/node_modules ./node_modules COPY --from=build /app/apps/edr-freight-api/dist ./dist COPY --from=build /app/apps/edr-freight-api/package.json ./package.json EXPOSE 3001 CMD ["node", "dist/main.js"]