We are setting up a micro-service based application. There lets say we have 20 micro services. all nodejs miroservices depends upon package.json with exactly same dependencies and dev dependencies. while deploying and updating them on cloud run docker file as:
FROM node:14 as node COPY --from=node . . WORKDIR /app COPY . /app RUN npm install RUN npm run build CMD ["node", "./dist/server.js"]
So basically call of them are fetching exactly the same node_modules and node14 images.
Is there any way to either pre-package node_modules into base docker image or copy it from shared location to improve the build time and make the new code in execution as fast as possible.
Is there any way t reduct the size of container as well? as each build ends up in consuming 1.3 GB in cloud storage which seems to become expensive really soon.
means 1.3GB * 20 per revision. and so if it is configured with CI then 2 deployments per day ..which is become like 45GB storage consumed per day 🙁