Skip to content

not working docker file #12330

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

Closed
NeilRiver opened this issue May 6, 2025 · 3 comments
Closed

not working docker file #12330

NeilRiver opened this issue May 6, 2025 · 3 comments

Comments

@NeilRiver
Copy link

Describe the Bug

I tried to build a website template and nothing worked

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/templates/website/Dockerfile

Reproduction Steps

 DOCKER_BUILDKIT=1 sudo docker build -t myapp:latest .
[+] Building 19.6s (12/20)                                                                                                                       docker:default
 => [internal] load build definition from Dockerfile                                                                                                       0.0s
 => => transferring dockerfile: 2.54kB                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/node:22.12.0-alpine                                                                                     2.4s
 => [internal] load .dockerignore                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                            0.0s
 => [base 1/1] FROM docker.io/library/node:22.12.0-alpine@sha256:51eff88af6dff26f59316b6e356188ffa2c422bd3c3b76f2556a2e7e89d080bd                          0.0s
 => [internal] load build context                                                                                                                         14.5s
 => => transferring context: 227.34MB                                                                                                                     14.3s
 => CACHED [builder 1/4] WORKDIR /app                                                                                                                      0.0s
 => CACHED [runner 2/8] RUN addgroup --system --gid 1001 nodejs                                                                                            0.0s
 => CACHED [runner 3/8] RUN adduser --system --uid 1001 nextjs                                                                                             0.0s
 => CACHED [deps 1/4] RUN apk add --no-cache libc6-compat                                                                                                  0.0s
 => CACHED [deps 2/4] WORKDIR /app                                                                                                                         0.0s
 => CACHED [deps 3/4] COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./                                                                   0.0s
 => ERROR [deps 4/4] RUN   if [ -f yarn.lock ]; then yarn --frozen-lockfile;   elif [ -f package-lock.json ]; then npm ci;   elif [ -f pnpm-lock.yaml ];   1.9s
------                                                                                                                                                          
 > [deps 4/4] RUN   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:
1.812 /usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21535
1.812   if (key == null || signature == null) throw new Error(`Cannot find matching keyid: ${JSON.stringify({ signatures, keys })}`);
1.812                                               ^
1.812 
1.812 Error: Cannot find matching keyid: {"signatures":[{"sig":"MEQCICN0DYf5CMgB9EG5d1WBA8kw83Ko1+aJItOTKA1xdSdlAiBOvmZjOKW3xzhfA4jyB/DgUSdbY68gzGtiyoVqfwwfAw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"keys":[{"expires":null,"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg=="}]}
1.812     at verifySignature (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21535:47)
1.812     at fetchLatestStableVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21553:5)
1.812     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
1.812     at async fetchLatestStableVersion2 (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21672:14)
1.812     at async Engine.getDefaultVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22292:23)
1.812     at async Engine.executePackageManagerRequest (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22390:47)
1.812     at async Object.runMain (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23096:5)
1.812 
1.812 Node.js v22.12.0
------

 3 warnings found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 67)
 - JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 71)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44)
Dockerfile:14
--------------------
  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

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

area: templates

Environment Info

Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 10.8.1
Relevant Packages:
  payload: 3.36.1
  next: 15.3.1
  @payloadcms/db-postgres: 3.36.1
  @payloadcms/email-nodemailer: 3.36.1
  @payloadcms/graphql: 3.36.1
  @payloadcms/live-preview: 3.36.1
  @payloadcms/live-preview-react: 3.36.1
  @payloadcms/next/utilities: 3.36.1
  @payloadcms/payload-cloud: 3.36.1
  @payloadcms/plugin-form-builder: 3.36.1
  @payloadcms/plugin-nested-docs: 3.36.1
  @payloadcms/plugin-redirects: 3.36.1
  @payloadcms/plugin-search: 3.36.1
  @payloadcms/plugin-seo: 3.36.1
  @payloadcms/richtext-lexical: 3.36.1
  @payloadcms/translations: 3.36.1
  @payloadcms/ui/shared: 3.36.1
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Fri Apr 25 15:43:38 UTC 2025
  Available memory (MB): 15449
  Available CPU cores: 12
@NeilRiver NeilRiver added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels May 6, 2025
@github-actions github-actions bot removed the validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. label May 6, 2025
@mnpqraven
Copy link

im getting the same error, you can fix this by pinning pnpm to an older version by adding corepack prepare [email protected] --activate after every corepack enable pnpm command. see

@NeilRiver
Copy link
Author

i dont understand... how can i build a project if during the build the "project is isolated" and doesn't see the DB?

docker

63.62 info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/app/api-reference/config/eslint#disabling-rules
67.48    Collecting page data ...
68.56 [19:14:37] ERROR: Error: cannot connect to Postgres. Details: connect ECONNREFUSED 127.0.0.1:5432
68.56     err: {
68.56       "type": "Error",
68.56       "message": "connect ECONNREFUSED 127.0.0.1:5432",
68.56       "stack":
68.56           Error: connect ECONNREFUSED 127.0.0.1:5432
68.56               at /app/.next/server/chunks/5613.js:356:807
68.56               at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
68.56               at async lx (/app/.next/server/chunks/5613.js:116:19565)
68.56               at async Object.l_ [as connect] (/app/.next/server/chunks/5613.js:116:19901)
68.56               at async tJ.init (/app/.next/server/chunks/5613.js:374:17302)
68.56               at async tX (/app/.next/server/chunks/5613.js:374:20600)
68.56               at async Object.Z [as generateStaticParams] (/app/.next/server/chunks/9086.js:1:52438)
68.56               at async builtRouteParams (/app/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/build/static-paths/app.js:277:36)
68.56               at async buildAppStaticPaths (/app/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/build/static-paths/app.js:247:25)
68.56               at async /app/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:920:79
68.56       "errno": -111,
68.56       "code": "ECONNREFUSED",
68.56       "syscall": "connect",
68.56       "address": "127.0.0.1",
68.56       "port": 5432
68.56     }
68.59  ⨯ Next.js build worker exited with code: 1 and signal: null
68.73  ELIFECYCLE  Command failed with exit code 1.
------
Dockerfile:32
--------------------
  31 |
  32 | >>> RUN \
  33 | >>>   if [ -f yarn.lock ]; then yarn run build; \
  34 | >>>   elif [ -f package-lock.json ]; then npm run build; \
  35 | >>>   elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
  36 | >>>   else echo "Lockfile not found." && exit 1; \
  37 | >>>   fi
  38 |
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ -f yarn.lock ]; then yarn run build;   elif [ -f package-lock.json ]; then npm run build;   elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build;   else echo \"Lockfile not found.\" && exit 1;   fi" did not complete successfully: exit code: 1

local run

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/app/api-reference/config/eslint#disabling-rules
 ✓ Linting and checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (11/11)
   Collecting build traces  ...

@denolfe
Copy link
Member

denolfe commented May 7, 2025

Duplicate of #11037 . The solution is here: #11037 (comment)

@denolfe denolfe closed this as completed May 7, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants