Skip to content

Incorrect docker configuration #44804

@coderNeos

Description

@coderNeos

Verify canary release

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

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 16.15.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.3.1
      eslint-config-next: 12.2.5
      react: 18.2.0
      react-dom: 18.2.0

P.s. Dockerfile in the example hasn't change in the canary

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)

Self deployed via docker-compose

Describe the Bug

Error occurs during build in standalone mode:

Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly

The bug is caused by line 20 in Dockerfile https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile#L20-L21

COPY --from=deps /app/node_modules ./node_modules
COPY . .

First it copies node_modules from deps and then it overrides them by copying from local directory COPY . .

Expected Behavior

It should build without any errors.

There's how to fix it: #35296 (comment)

To Reproduce

See related discussion #35296

Metadata

Metadata

Assignees

No one assigned

    Labels

    examplesIssue was opened via the examples template.lockedstaleThe issue has not seen recent activity.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions