I need to run nodejs project (which is a server of a react app) on a docker container and i cant find a npm command that would create a dist folder to put in the dockerfile.
i would very much appreciate any help!
I need to run nodejs project (which is a server of a react app) on a docker container and i cant find a npm command that would create a dist folder to put in the dockerfile.
i would very much appreciate any help!
2
Answers
Usually the
dist/
folder is created by the build tool (webpack, vite, parcel, etc). So there’s no command that just says "create this directory." If you’re usingcreate-react-app
then it would benpm run build
but I believe CRA is actually outputting to abuild/
directory and notdist/
.Really it just depends on what you’re wanting to do exactly. Are you looking for a command to build the application for the docker file? Are you looking to just have a path? etc.
I know you’re using react. But this answer is for the Angular folks because I had the same question, but for Angular.
You type in this command –
That will create the dist folder.
Documentation can be found here –
https://angular.io/guide/deployment#building-and-serving-from-disk