From 6638b6a93dc5f8adfc91754f907ccd60d94b1761 Mon Sep 17 00:00:00 2001 From: TheMaddax Date: Sun, 1 Dec 2024 21:11:15 -0600 Subject: [PATCH] Update with proper pnpm usage --- Dockerfile | 24 ++++++++++++------------ package.json | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index b95e26b..cb71467 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,28 @@ FROM node:18-alpine AS base 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 WORKDIR /app -COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ -RUN \ - if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ - elif [ -f package-lock.json ]; then npm ci; \ - elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ - else echo "Lockfile not found." && exit 1; \ - fi +# Install pnpm +RUN corepack enable && corepack prepare pnpm@latest --activate + +# Copy package files +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile # Rebuild the source code only when needed FROM base AS builder WORKDIR /app + +# Install pnpm in builder stage +RUN corepack enable && corepack prepare pnpm@latest --activate + COPY --from=deps /app/node_modules ./node_modules COPY . . ENV NEXT_TELEMETRY_DISABLED 1 - -RUN npm run build +RUN pnpm run build # Production image, copy all the files and run next FROM base AS runner @@ -40,7 +41,6 @@ RUN mkdir .next RUN chown nextjs:nodejs .next # Automatically leverage output traces to reduce image size -# https://nextjs.org/docs/advanced-features/output-file-tracing COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static @@ -51,4 +51,4 @@ EXPOSE 3000 ENV PORT 3000 ENV HOSTNAME "0.0.0.0" -CMD ["node", "server.js"] \ No newline at end of file +CMD ["node", "server.js"] diff --git a/package.json b/package.json index 6e02d00..eec577f 100644 --- a/package.json +++ b/package.json @@ -44,5 +44,6 @@ "postcss": "^8", "tailwindcss": "^3.3.0", "typescript": "^5" - } + }, + "packageManager": "pnpm@9.14.4+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab" }