Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Docker build doesn't work when you have multiple images on a single page in the app directory on Mac OS (M1). #57894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
singleseeker opened this issue Nov 1, 2023 · 1 comment
Labels
examples Issue was opened via the examples template. stale The issue has not seen recent activity.

Comments

@singleseeker
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:43:05 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6020
Binaries:
  Node: 19.8.1
  npm: 9.5.1
  Yarn: 3.5.0
  pnpm: 8.5.1
Relevant Packages:
  next: 14.0.2-canary.5
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: N/A
Next.js Config:
  output: standalone

Which example does this report relate to?

with-docker

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

When I try to build the project, I can not build it successfully.

I got an error code.

 => ERROR [builder 4/4] RUN yarn build                                                                                  8.4s 
------                                                                                                                       
 > [builder 4/4] RUN yarn build:                                                                                             
1.102 yarn run v1.22.19                                                                                                      
1.207 $ next build                                                                                                           
4.392    ▲ Next.js 14.0.2-canary.5                                                                                           
4.394 
4.395    Creating an optimized production build ...
8.256 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
8.277 Segmentation fault
8.312 error Command failed with exit code 139.
8.312 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
Dockerfile:32
--------------------
  30 |     ENV NEXT_TELEMETRY_DISABLED 1
  31 |     
  32 | >>> RUN yarn build
  33 |     
  34 |     # If using npm comment out above and use below instead
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn build" did not complete successfully: exit code: 139

Expected Behavior

Build success on Mac OS Apple chip.

To Reproduce

You can clone this project with the following link and have a try.
https://github.com/singleseeker/nextjs-docker-test

Here is how the errors come.

  1. Use the App directory way in your project.
  2. Load more than 5 images on one page.
  3. Have a sharp package in your project.
  4. Deploy the project with docker in Mac OS( For me, my Mac use a Apple M2 chip)

files structure

├── package.json
├── public
│   ├── favicon.ico
│   └── vercel.svg
├── src
│   └── app
│       ├── layout.js
│       ├── page.js
│       └── small
// npm i sharp
import React from 'react'


import img1 from "./small/img-1.jpg";
import img2 from "./small/img-2.jpg";
import img3 from "./small/img-3.jpg";
import img4 from "./small/img-4.jpg";
import img5 from "./small/img-5.jpg";
import img6 from "./small/img-6.jpg";
import Image from 'next/image';



function Home() {
  return (
    <>
      <Image src={img1} alt="Picture of the author" />
      <Image src={img2} alt="Picture of the author" />
      <Image src={img3} alt="Picture of the author" />
      <Image src={img4} alt="Picture of the author" />
      <Image src={img5} alt="Picture of the author" />
      <Image src={img6} alt="Picture of the author" />
    </>
  )
}

export default Home
@singleseeker singleseeker added the examples Issue was opened via the examples template. label Nov 1, 2023
@nextjs-bot
Copy link
Collaborator

This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

@nextjs-bot nextjs-bot added the stale The issue has not seen recent activity. label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Issue was opened via the examples template. stale The issue has not seen recent activity.
Projects
None yet
Development

No branches or pull requests

2 participants