vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.9k stars 26.87k forks source link

Docker standalone is missing sharp #65679

Open Tobi-mmt opened 5 months ago

Tobi-mmt commented 5 months ago

Verify canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112
Binaries:
  Node: 20.10.0
  npm: 10.6.0
  Yarn: 1.22.19
  pnpm: 9.0.6
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.0.4
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
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 deploye the folloeing example https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile the logs output the following error: Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production

Expected Behavior

The image optimization with the given example works well outside of an vercel hostign system.

To Reproduce

Just build an image with the given example and let it run on a system where sharp is not installed, so deploy it somwhere else than vercel.

Tobi-mmt commented 5 months ago

A quick research allows me to say that there are a bunch of people which are struggling with the sharp intergration in a docker file. See