Skip to content

Commit 031fae7

Browse files
committed
🔄 Synced local '.' with remote 'apps/examples/nextjs'
1 parent e6040fa commit 031fae7

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

Dockerfile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
FROM node:18-alpine AS base
1+
FROM node:20-alpine AS base
22

33
# Install dependencies only when needed
44
FROM base AS deps
55
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
66
RUN apk add --no-cache libc6-compat
77
WORKDIR /app
88

9-
# Install dependencies based on the preferred package manager
10-
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
11-
RUN \
12-
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
13-
elif [ -f package-lock.json ]; then npm ci; \
14-
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
15-
else echo "Lockfile not found." && exit 1; \
16-
fi
9+
# Install package manager
10+
RUN --mount=type=cache,id=pnpm-auth-store,target=/root/.pnpm-store \
11+
npm i --global --no-update-notifier --no-fund pnpm@latest
12+
13+
14+
# Install dependencies
15+
COPY package.json ./
16+
RUN pnpm i
1717

1818

1919
# Rebuild the source code only when needed
@@ -27,12 +27,7 @@ COPY . .
2727
# Uncomment the following line in case you want to disable telemetry during the build.
2828
# ENV NEXT_TELEMETRY_DISABLED 1
2929

30-
RUN \
31-
if [ -f yarn.lock ]; then yarn run build; \
32-
elif [ -f package-lock.json ]; then npm run build; \
33-
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
34-
else echo "Lockfile not found." && exit 1; \
35-
fi
30+
RUN pnpm run build
3631

3732
# Production image, copy all the files and run next
3833
FROM base AS runner

0 commit comments

Comments
 (0)