strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.17k stars 445 forks source link

Yarn build trigger error Command "build" not found in Docker #304

Open alexisrolland opened 3 years ago

alexisrolland commented 3 years ago

Hello and thank you for building Strapi. It looks awesome.

I'm building a custom Docker image based on the file: https://github.com/strapi/strapi-docker/blob/master/examples/custom/Dockerfile

The command RUN yarn build triggers the error message:

RUN yarn build:
#11 0.577 yarn run v1.22.5
#11 0.649 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#11 0.649 error Command "build" not found.

Research on StackOverflow points out this is because the file package.json is lacking the build key: https://stackoverflow.com/questions/55789355/build-node-js-app-using-yarn-but-getting-error-command-build-not-found

I think this is because I reused the whole code base from the root of the repo here: https://github.com/strapi/strapi-docker And indeed the package.json does not contain much: https://github.com/strapi/strapi-docker/blob/master/package.json

Thank you

PS: I cannot use the prebuilt image strapi/strapi due to network restrictions in my environment which prevents me to download dependencies from the public NPM registry.

nefarioustim commented 2 years ago

To build the images, you need to run the build script. This is documented, but it's right at the bottom of the README so pretty easy to miss. Run the following commands in your shell:

yarn install
./bin/build.js

You can get help on the build script using:

./bin/build.js