I want to run osjs in production mode, so I use ENV NODE_ENV=production in my Dockerfile.
But since in production mode devDependencies are not installed, so my apps can not built (webpack is not available).
Here is my Dockerfile.
FROM node:14.15.0-alpine
WORKDIR /usr/src/osjs
ENV NODE_ENV=production
COPY . .
COPY files/packages ./src/packages
RUN rm -rf files
RUN npm install
RUN cd ./src/packages/osjs-splash \
&& npm install \
&& npm run build
WORKDIR /usr/src/osjs
EXPOSE 8000
CMD ./my-entrypoint.sh
If I only put the dist folder in packages directory, without node_modules, it cause a problem which maybe app server-side needs a module like axios. Is it recommended to add all node_modules needed in server-side of all applications in dependencies of osjs project?
I want to run osjs in
production
mode, so I useENV NODE_ENV=production
in myDockerfile
. But since inproduction
modedevDependencies
are not installed, so my apps can not built (webpack
is not available).Here is my
Dockerfile
.If I only put the
dist
folder inpackages
directory, withoutnode_modules
, it cause a problem which maybe app server-side needs a module likeaxios
. Is it recommended to add allnode_modules
needed in server-side of all applications independencies
of osjs project?So what is the right way for
production
mode?