My company is using bitbucket-pipeline alongside with docker to build an image of the application before deploying it.
When I'm reading into the docker file, I can see these lines:
(ignored a bunch of lines)
RUN yarn install
RUN yarn run my-script
COPY . .
and in pipeline, I see this script
docker build .
My question is, is there any reason why I should put RUN yarn install
and RUN yarn run my-script
into docker and not in pipeline?
My reasons behind putting it in pipeline is so you can utilise cache from bitbucket pipeline, as well as lower the size of the docker image (I understand that few layers means smaller image size).