What is the best way to deploy a compiled language project with docker and jenkins? I have a java project, and I'm generating .jar file.
My question is what is the best practice to use docker and jenkins for build and deploy the project?
Is it build the jar with one docker image, then put the Jar file in another docker image and run a container from the last image in the production env or is there a better way to do that?
I do not know how how about Jenkins, but GitLab CI has feature called artifacts which allow you to


explitely share some files/directories between builds
download them from GitLab Pipeline view


Additional pro is that allows you to make deployments manual actions.

Also if you are building fat JARs you do not need Docker for your deployments at all.

So the best solution for you is to have separate task for building release and separate for deployment (which can be manual job or not).