diff --git a/examples/with-docker-compose/next-app/dev.Dockerfile b/examples/with-docker-compose/next-app/dev.Dockerfile index e46c559e33c98..d884b71394361 100644 --- a/examples/with-docker-compose/next-app/dev.Dockerfile +++ b/examples/with-docker-compose/next-app/dev.Dockerfile @@ -7,7 +7,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ # Allow install without lockfile, so example works even without Node.js installed locally else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \ fi @@ -28,5 +28,5 @@ CMD \ if [ -f yarn.lock ]; then yarn dev; \ elif [ -f package-lock.json ]; then npm run dev; \ elif [ -f pnpm-lock.yaml ]; then pnpm dev; \ - else yarn dev; \ + else npm run dev; \ fi diff --git a/examples/with-docker-compose/next-app/prod-without-multistage.Dockerfile b/examples/with-docker-compose/next-app/prod-without-multistage.Dockerfile index e17d8765e337d..4be3076b01c1f 100644 --- a/examples/with-docker-compose/next-app/prod-without-multistage.Dockerfile +++ b/examples/with-docker-compose/next-app/prod-without-multistage.Dockerfile @@ -8,7 +8,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ # Allow install without lockfile, so example works even without Node.js installed locally else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \ fi @@ -36,7 +36,7 @@ RUN \ if [ -f yarn.lock ]; then yarn build; \ elif [ -f package-lock.json ]; then npm run build; \ elif [ -f pnpm-lock.yaml ]; then pnpm build; \ - else yarn build; \ + else npm run build; \ fi # Start Next.js based on the preferred package manager @@ -44,5 +44,5 @@ CMD \ if [ -f yarn.lock ]; then yarn start; \ elif [ -f package-lock.json ]; then npm run start; \ elif [ -f pnpm-lock.yaml ]; then pnpm start; \ - else yarn start; \ + else npm run start; \ fi diff --git a/examples/with-docker-compose/next-app/prod.Dockerfile b/examples/with-docker-compose/next-app/prod.Dockerfile index 907e9e5b38b70..eca0431f72211 100644 --- a/examples/with-docker-compose/next-app/prod.Dockerfile +++ b/examples/with-docker-compose/next-app/prod.Dockerfile @@ -11,7 +11,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ # Allow install without lockfile, so example works even without Node.js installed locally else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \ fi @@ -37,7 +37,7 @@ RUN \ if [ -f yarn.lock ]; then yarn build; \ elif [ -f package-lock.json ]; then npm run build; \ elif [ -f pnpm-lock.yaml ]; then pnpm build; \ - else yarn build; \ + else npm run build; \ fi # Note: It is not necessary to add an intermediate step that does a full copy of `node_modules` here diff --git a/examples/with-docker-multi-env/docker/development/Dockerfile b/examples/with-docker-multi-env/docker/development/Dockerfile index 5627577363b6c..fcd72319d56ab 100644 --- a/examples/with-docker-multi-env/docker/development/Dockerfile +++ b/examples/with-docker-multi-env/docker/development/Dockerfile @@ -12,7 +12,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ else echo "Lockfile not found." && exit 1; \ fi @@ -23,7 +23,7 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . # This will do the trick, use the corresponding env file for each environment. COPY .env.development.sample .env.production -RUN yarn build +RUN npm run build # 3. Production image, copy all the files and run next FROM base AS runner diff --git a/examples/with-docker-multi-env/docker/production/Dockerfile b/examples/with-docker-multi-env/docker/production/Dockerfile index b6892e9c0ab10..6a34ca639ea57 100644 --- a/examples/with-docker-multi-env/docker/production/Dockerfile +++ b/examples/with-docker-multi-env/docker/production/Dockerfile @@ -12,7 +12,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ else echo "Lockfile not found." && exit 1; \ fi @@ -24,7 +24,7 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . # This will do the trick, use the corresponding env file for each environment. COPY .env.production.sample .env.production -RUN yarn build +RUN npm run build # 3. Production image, copy all the files and run next FROM base AS runner diff --git a/examples/with-docker-multi-env/docker/staging/Dockerfile b/examples/with-docker-multi-env/docker/staging/Dockerfile index 14b3ae0c78afd..4d6917f11f871 100644 --- a/examples/with-docker-multi-env/docker/staging/Dockerfile +++ b/examples/with-docker-multi-env/docker/staging/Dockerfile @@ -12,7 +12,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ else echo "Lockfile not found." && exit 1; \ fi @@ -24,7 +24,7 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . # This will do the trick, use the corresponding env file for each environment. COPY .env.staging.sample .env.production -RUN yarn build +RUN npm run build # 3. Production image, copy all the files and run next FROM base AS runner diff --git a/examples/with-docker/Dockerfile b/examples/with-docker/Dockerfile index e55824e713563..643c902d31b0f 100644 --- a/examples/with-docker/Dockerfile +++ b/examples/with-docker/Dockerfile @@ -11,7 +11,7 @@ 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; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ else echo "Lockfile not found." && exit 1; \ fi @@ -27,7 +27,7 @@ COPY . . # Uncomment the following line in case you want to disable telemetry during the build. # ENV NEXT_TELEMETRY_DISABLED 1 -RUN yarn build +RUN npm run build # If using npm comment out above and use below instead # RUN npm run build