gatsbyjs/gatsby

compile file failed on docker

afreisinger opened this issue · 2 comments

Preliminary Checks

Description

Hi everyone !

I receive the following error:

git clone git@github.com:gatsbyjs/gatsby-starter-default.git
cd gatsby-starter-default
docker run -it -p 8000:8000 -v ${PWD}:/site --name gatsby afreisinger/gatsby:20.10.0

This is the error:

⠏ compile gatsby files
/site/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Initiated Worker with invalid execArgv flags: --no-opt
    at new Worker (node:internal/worker:222:13)
    at ThreadsWorker.start (/site/node_modules/@parcel/workers/lib/threads/ThreadsWorker.js:51:19)
    at Worker.fork (/site/node_modules/@parcel/workers/lib/Worker.js:105:23)
    at WorkerFarm.startChild (/site/node_modules/@parcel/workers/lib/WorkerFarm.js:248:12)
    at WorkerFarm.startMaxWorkers (/site/node_modules/@parcel/workers/lib/WorkerFarm.js:420:14)
    at new WorkerFarm (/site/node_modules/@parcel/workers/lib/WorkerFarm.js:149:10)
    at createWorkerFarm (/site/node_modules/@parcel/core/lib/Parcel.js:568:10)
    at Parcel._init (/site/node_modules/@parcel/core/lib/Parcel.js:232:20)
    at Parcel.run (/site/node_modules/@parcel/core/lib/Parcel.js:273:7)
    at Object.runParcel (/site/node_modules/gatsby/src/utils/parcel/compile-gatsby-files.ts:66:27) {
  code: 'ERR_WORKER_INVALID_EXEC_ARGV'
}

Dockerfile

FROM node:20.10.0-slim
RUN apt-get update && \
    apt-get install -y git curl procps && \
    git config --global --add safe.directory /site && \
    npm install -g gatsby-cli typescript vercel netlify-cli && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /site
# Put this into separate layer so that changes in setup.sh don't cause NPM install.
COPY setup.sh /usr/bin
RUN chmod u+x /usr/bin/setup.sh

ENTRYPOINT ["/usr/bin/setup.sh"]

Reproduction Link

https://github.com/afreisinger/docker-gatsby.git

Steps to Reproduce

git clone git@github.com:gatsbyjs/gatsby-starter-default.git
cd gatsby-starter-default
docker run -it -p 8000:8000 -v ${PWD}:/site --name gatsby afreisinger/gatsby:20.10.0

Expected Result

No errors

Actual Result

code: 'ERR_WORKER_INVALID_EXEC_ARGV'

Environment

Apple M1
Sonoma 14.5
Node:20.10.0

Config Flags

No response

This running fine on Apple Intel.

I resolved it by building it with multi-platform support.