Hello, im kinda new to GitLab CI and i have a question. We have a js project and it needs some dependecies (installing in “npm ci” and “npm build” stages), that dependecies kinda constant and we use them in other projects. So i want to create image with this dependencies and use it as a base for every work building image. Problem is, i need to check “package.json” and rebuild my base image if dependencies have been changed. Is it possible to achive it in one .yml script? Thanks a lot for help!
Hello,
I think that the easiest way to do what you need is as follows:
- Configure your GitLab CU Runner to use the Shell executor.
- Create a shell script on the Runner machine, which will do whatever you need.
- Call that script from your gitlab-ci.yml.
2 Likes
So, its not possible with docker-runner, yes?
I don’t know, maybe it’s possible. I just don’t have enough experience with the Docker executor.
I also don’t understand what’s it advantage over Shell executor for regular software projects.
@badman02, maybe you should check https://docs.gitlab.com/ee/ci/yaml/#onlychanges and create image build and push job only when package.json file was changed?
1 Like
Oh, thanks a lot, you’ve made my day! )
1 Like