diff --git a/Dockerfile b/Dockerfile index b7ff415..54d492e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,12 @@ WORKDIR /app # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ + +# Copy cached files +COPY node_modules ./ + +RUN npm i + # RUN \ # if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ # elif [ -f package-lock.json ]; then npm ci; \ @@ -16,7 +22,7 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ # Rebuild the source code only when needed FROM node:18-alpine AS builder WORKDIR /app -# COPY --from=deps /app/node_modules ./node_modules +COPY --from=deps /app/node_modules ./node_modules COPY . . # Next.js collects completely anonymous telemetry data about general usage. @@ -24,11 +30,6 @@ COPY . . # Uncomment the following line in case you want to disable telemetry during the build. ENV NEXT_TELEMETRY_DISABLED 1 -# Copy cached files -COPY node_modules ./ - -RUN npm i - # Build the project RUN yarn build