Copy file from one stage to next

10/8/2019

I am using Jenkins in a Kubernetes environment. I have a step that uses a maven container to package a jar. I would like to use this jar in the next stage of my pipeline to create a docker image using another container docker. Is this possible?

-- Squirrel
jenkins-groovy
jenkins-pipeline
kubernetes

2 Answers

10/8/2019

You can choose for multistage builds, at docker level only, where you can take the base image and then make maven jar of it and then use this jar as base image for next step and you can create your final docker image snapshot this way.

Refer this -

https://docs.docker.com/develop/develop-images/multistage-build/

-- Tushar Mahajan
Source: StackOverflow

10/8/2019

I noticed the workspace is shared across containers in the pod so the jar is available to build from the docker container.

-- Squirrel
Source: StackOverflow