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?
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/
I noticed the workspace is shared across containers in the pod so the jar is available to build from the docker container.