Skip to content

Commit df95d51

Browse files
committed
refactor Dockerfile to streamline dependency installation with pnpm
1 parent 31ce5f1 commit df95d51

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

Dockerfile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,14 @@ FROM base AS deps
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 yarn global add pnpm && pnpm i --frozen-lockfile; \
15-
else echo "Lockfile not found." && exit 1; \
16-
fi
9+
# Install dependencies with pnpm
10+
COPY pnpm-lock.yaml package.json ./
11+
RUN npm i -g pnpm && pnpm i --frozen-lockfile
1712

1813

1914
# Rebuild the source code only when needed
2015
FROM base AS builder
2116
WORKDIR /app
22-
RUN yarn global add pnpm
23-
2417
COPY --from=deps /app/node_modules ./node_modules
2518
COPY . .
2619

@@ -31,9 +24,6 @@ ENV NEXT_TELEMETRY_DISABLED 1
3124

3225
RUN pnpm build
3326

34-
# If using npm comment out above and use below instead
35-
# RUN npm run build
36-
3727
# Production image, copy all the files and run next
3828
FROM base AS runner
3929
WORKDIR /app

0 commit comments

Comments
 (0)