astefanutti opened a new pull request #2536:
URL: https://github.com/apache/camel-k/pull/2536


   This is a proof-of-concept PR to add Quarkus native build support.
   
   I've tested it successfully on OpenShift (CRC), with a simple YAML 
Integration:
   
   ```
   2021-07-29 10:20:37,254 INFO  [org.apa.cam.k.Runtime] (main) Apache Camel K 
Runtime 1.8.0
   2021-07-29 10:20:37,254 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] 
(main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
   2021-07-29 10:20:37,255 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) 
Loading routes from: SourceDefinition{name='camel-k-embedded-flow', 
language='yaml', type='source', 
location='file:/etc/camel/sources/camel-k-embedded-flow.yaml', }
   2021-07-29 10:20:37,259 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] 
(main) Routes startup summary (total:1 started:1)
   2021-07-29 10:20:37,259 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] 
(main)     Started route1 (timer://tick)
   2021-07-29 10:20:37,259 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] 
(main) Apache Camel 3.11.0 (camel-1) started in 2ms (build:0ms init:1ms 
start:1ms)
   2021-07-29 10:20:37,259 INFO  [io.quarkus] (main) camel-k-integration 
1.6.0-SNAPSHOT native (powered by Quarkus 2.0.0.Final) started in 0.025s. 
   2021-07-29 10:20:37,259 INFO  [io.quarkus] (main) Profile prod activated. 
   2021-07-29 10:20:37,259 INFO  [io.quarkus] (main) Installed features: 
[camel-bean, camel-core, camel-k-core, camel-k-runtime, camel-log, 
camel-support-common, camel-timer, camel-yaml-dsl, cdi]
   2021-07-29 10:20:38,260 INFO  [info] (Camel (camel-1) thread #0 - 
timer://tick) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello 
Yaml !!!]
   ```
   
   The first build duration is about 7m43s (including Maven dependencies 
download),  while a second build is about 7m29s:
   
   ```
   k get builds.camel.apache.org
   NAME                       PHASE       AGE     STARTED   DURATION          
ATTEMPTS
   kit-c417u8e3709squm11hl0   Succeeded   10m     10m       7m43.463255655s
   kit-c4189u63709squm11hlg   Succeeded   7m36s   7m36s     7m29.756844671s
   ```
   
   Note this is a build performed for a simple Integration, on a CRC cluster.
   
   Also the build image size is reduced to 73.2MB when using the 
`quay.io/quarkus/quarkus-distroless-image` base image:
   
   ```
   docker image ls
   REPOSITORY                                                                   
                      TAG               IMAGE ID       CREATED             SIZE
   
default-route-openshift-image-registry.apps-crc.testing/camel-k/camel-k-kit-c4189u63709squm11hlg
   <none>            13eb7fb8fb64   5 minutes ago       73.2MB
   ```
   
   It also works with a JavaScript Integration, by adding the 
`quarkus.native.additional-build-args=--language:js` build property. On the 
other hand, I've faced a NPE at start time with a Java Integration, during the 
JOOR compilation, that seems to rely on reflection.
   
   I've tested it with the 
`quay.io/quarkus/ubi-quarkus-mandrel:21.2.0.0-Final-java11` image, but the 
native build fails for some reasons.
   
   TODO:
   
   - [ ] Proper configurability (Quarkus trait, disable the JVM trait 
automatically, ...)
   - [ ] Disable incremental image build automatically
   - [ ] Bring support to the Spectrum, Kaniko and Buildah build strategies
   
   **Release Note**
   ```release-note
   feat: Quarkus native build support
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to