@@ -6,6 +6,9 @@ RUN apt-get update \
66 && rm -rf /var/lib/apt/lists/*
77
88FROM base AS deps
9+
10+ RUN npm install -g pnpm
11+
912RUN apt-get update \
1013 && apt-get install -y --no-install-recommends \
1114 git \
@@ -15,28 +18,25 @@ RUN apt-get update \
1518 libc6-dev \
1619 libvips-dev \
1720 && rm -rf /var/lib/apt/lists/*
21+
1822WORKDIR /app
1923
2024COPY package.json ./
2125
22- # Check the link regarding legacy-peer-deps
23- # https://payloadcms.com/docs/getting-started/installation#1-install-the-relevant-packages
24- # Keep optional deps so platform-specific native bindings (e.g. @swc/core) download prebuilts
25- RUN npm i --legacy-peer-deps --no-audit --no-fund
26+ RUN pnpm install \
27+ && pnpm store prune \
28+ && STORE_PATH= "$(pnpm store path --silent)" \
29+ && rm -rf "$STORE_PATH"
2630
2731# Copy the dependencies to builder stage.
2832# Lock file is important for Nx to calculate a correct project graph.
2933FROM base AS builder
3034
3135WORKDIR /app
32- COPY --from=deps /app/node_modules ./node_modules
33- COPY --from=deps /app/package -lock.json ./package -lock.json
36+ COPY --from=deps /app/node_modules ./node_modules
37+ COPY --from=deps /app/pnpm -lock.yaml ./pnpm -lock.yaml
3438COPY . .
3539
36- # The lock file is hidden from the build process when included in the .gitignore file.
37- # Since package-lock.json is needed when building the app, we'll remove it from .gitignore.
38- RUN sed -i '/package-lock.json/d' .gitignore
39-
4040# Build arguments for Next.js client-side environment variables
4141# These are embedded in the JavaScript bundle during build
4242ARG NEXT_PUBLIC_DEPLOY_ENV
@@ -69,9 +69,9 @@ FROM base AS runner
6969
7070WORKDIR /app
7171
72- ENV NODE_ENV production
72+ ENV NODE_ENV= production
7373# Disable telemetry during runtime.
74- ENV NEXT_TELEMETRY_DISABLED 1
74+ ENV NEXT_TELEMETRY_DISABLED= 1
7575
7676# Automatically leverage output traces to reduce image size
7777# https://nextjs.org/docs/advanced-features/output-file-tracing
@@ -92,7 +92,7 @@ USER nextjs
9292
9393EXPOSE 3000
9494
95- ENV PORT 3000
95+ ENV PORT= 3000
9696
9797ENV HOSTNAME="0.0.0.0"
9898CMD ["node" , "apps/cms/server.js" ]
0 commit comments