devonfw / shop-floor

Tools, scripts and strategies to deploy Devonfw projects (Angular + Java) and provision an unmanaged alternative for complete CICD environments based on Docker/Kubernetes/OpenShift
Apache License 2.0
7 stars 14 forks source link

Add Extended Build for S2I building image #22

Closed cbeldacap closed 4 years ago

cbeldacap commented 6 years ago

Category: Enhancement Severity: HIGH

Description of issue / expected enhacement /Comments Currently s2i images follow this process:

  1. FROM Centos7 blank image.
  2. Installation of nodejs/maven
  3. Artifact building (using installed tools)
  4. Artifact deployment

Everything is done on the same container, resulting in very large images of more that 1GiB each.

Including the multi-staging build (used in MyThaiStar Dockerfiles) would strongly decrease the size of the image.

In s2i terminology, we should include the Extended Build pattern to both Angular and Java s2i images, as described here:

For compiled languages (Go, C, C++, Java, etc.) the dependencies necessary for compilation might increase the size of the image or introduce vulnerabilities that can be exploited.

To avoid these problems, S2I (Source-to-Image) introduces a two-image build process that allows an application to be built via the normal flow in a builder image, but then injects the resulting application artifacts into a runtime-only image for execution.

So, adding this functionality, new process should similary work like this:

  1. FROM Maven/NodeJS-AngularCLI image
  2. Artifact building (dist/ and .war)
  3. FROM Nginx/Java-Maven image (artifact injection)
  4. Artifact deployment

Your environment: DOCKER, OPENSHIFT

dario-rodriguez commented 4 years ago

I think s2i do not support multistage builds, so I close this issue.