Skip to content

Dockerfile from template fails to build #13019

Open
@anatolykopyl

Description

@anatolykopyl

Describe the Bug

The Dockerfile placed in the root of a project created with create-payload-app does not build.
Output:

--------------------
  13 |     COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
  14 | >>> RUN \
  15 | >>>   if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  16 | >>>   elif [ -f package-lock.json ]; then npm ci; \
  17 | >>>   elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
  18 | >>>   else echo "Lockfile not found." && exit 1; \
  19 | >>>   fi
  20 |
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ -f yarn.lock ]; then yarn --frozen-lockfile;   elif [ -f package-lock.json ]; then npm ci;   elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile;   else echo \"Lockfile not found.\" && exit 1;   fi" did not complete successfully: exit code: 1

I tried the file provided in the docs and it worked. The only difference between them is the base image: node:18-alpine vs node:22.12.0-alpine.

Switching to node:22-alpine or node:22.17.0-alpine also makes the docker build succeed.

Link to the code that reproduces this issue

https://github.com/anatolykopyl/payload-docker-repro

Reproduction Steps

docker build .

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: 10.12.4
Relevant Packages:
  payload: 3.44.0
  next: 15.3.2
  @payloadcms/db-mongodb: 3.44.0
  @payloadcms/email-nodemailer: 3.44.0
  @payloadcms/graphql: 3.44.0
  @payloadcms/next/utilities: 3.44.0
  @payloadcms/payload-cloud: 3.44.0
  @payloadcms/richtext-lexical: 3.44.0
  @payloadcms/translations: 3.44.0
  @payloadcms/ui/shared: 3.44.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:48:46 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions