I have multiple react apps in my project and want to build them in a gitlab pipeline. I have to keep multiple single react apps. I can not compose them into one single react app. So my problem is: at the moment the gitlab job takes very long because I have to run yarn install in each react app I think.
my gitlab-ci.yml snippet looks like this:
script:
- cd react
- for d in ./*/ ; do (cd "$d" && pwd && yarn install && yarn build); done
Is there any better way than to do 'yarn install' in each react app which results in a node_modules folder for each single react app?
Can you cache the node_modules folder between gitlab jobs so the yarn install will use the cached version and updates it if necessary?
Or can you place the node_modules folder in a location where all react apps will get their dependencies from? So the same modules wont be downloaded again and again in the same gitlab job?
I am not familiar with gitlab CI CD and especially not with gitlab CI caching