Do I have to compile my application inside a docker image

Although most of the time I develop Java applications and just use Maven, so my builds should be reproducible (at least what Maven says).

But tell me, are you compiling a program in C ++ or something even more active if you build inside a docker?
Or, ideally, use a stroller or other technology to play breeding assemblies.

How do you manage a replayable build with docker?

+4
source share
2 answers

You can, but not in your final image, because it will mean a much larger image than necessary: ​​it will include the entire compilation tool, and not limit only what you need to execute the resulting binary.

You can see the alternative in How to create a Docker image for a Ruby project without build tools?

  • I use the image for the assembly,
  • I commit the received stopped container as a new image (with the volume, including the resulting binary).
  • I am using a runtime image (one that contains only what you need to run) and copy the binary from another image. I again transfer the received container.

The final image includes a compiled binary and runtime.

+5
source

, VonC. Redhat Openshift, Source to Image s2i, . ( ) , , .

+1

Source: https://habr.com/ru/post/1666972/


All Articles