Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I have to npm install in every step in a bitbucket pipeline that I need to use an npm command

I have a bitbucket pipelines yml that I have step for running my test script and a step to run a serverless deploy script. Do I need to npm install at each step or will the first npm install carry through and suffice for each subsequent step. Further than that, what is happening under the hood? I know Docker container is created; does each step just update the container?

- step:
        name: Test and Build
        script: 
          - npm install --no-package-lock
          - npm run test
    - step:
        name: Deploy Serverless
        script:
          - npm i serverless -g
          - npm install --no-package-lock
          - npm run deploy
like image 948
ardev Avatar asked Feb 04 '23 18:02

ardev


1 Answers

Can you implement it like the documentation: https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html

The functionality is there. Let me know if it doesn't work for you still.

like image 184
Mihai Avatar answered Feb 06 '23 07:02

Mihai