Why are the WORKDIR AND COPY commands given twice in the dockerfile? Pl explain
@DGRUploads4 ай бұрын
Because we are building a multi-stage dockerfile. Each stage has its own instructions. Since we are using multiple stages, i am using WORKDIR and COPY multiple times. Hope this helps!
@ManiBalajiC6 ай бұрын
why not just use the .jar from the Jenkins build and use it in docker to run it .why we need to build in docker too ?
@DGRUploads6 ай бұрын
That is just an option. We can definitely use Jenkins to build the package. The example i have used is to show how the multi-stage can be used in case you can do the build from an image. With Jenkins, you will end up keep all the files from the build. Could be logs, temp files, etc which you do not really need and this eats up your space. With Docker, you are only using what you need and removing the unnecessary files.