こんばんは、エキサイト株式会社の中尾です。
quarkusといえば、native compileでしょう。 まずはjvmで。
shogo.nakao@localhost:(main*) $ docker build -f src/main/docker/Dockerfile.jvm -t quarkus/hobby-jvm . [+] Building 100.3s (11/11) FINISHED => [internal] load build definition from Dockerfile.jvm 0.0s => => transferring dockerfile: 2.15kB 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 111B 0.0s => [internal] load metadata for registry.access.redhat.com/ubi8/ubi-minimal:8.4 7.9s => [1/6] FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4@sha256:c536d4c63253318fdfc1db499f8f4bb0881db7fbd6f3d1554b4d54c812f85cc7 14.1s => => resolve registry.access.redhat.com/ubi8/ubi-minimal:8.4@sha256:c536d4c63253318fdfc1db499f8f4bb0881db7fbd6f3d1554b4d54c812f85cc7 0.0s => => sha256:d46336f50433ab27336fad8f9b251b2f68a66d376c902dfca23a6851acae502c 39.29MB / 39.29MB 12.5s => => sha256:be961ec6866344c06fe85e53011321da508bc495513bb75a45fc41f6182921b6 1.74kB / 1.74kB 3.5s => => sha256:c536d4c63253318fdfc1db499f8f4bb0881db7fbd6f3d1554b4d54c812f85cc7 1.47kB / 1.47kB 0.0s => => sha256:4d6547bbb7c5fe0f0d37b491c0c1975ff96bf4cf1c26dd665e3a5d70918b5564 737B / 737B 0.0s => => sha256:e7685639f55280ffe8da3724cb1d342091a1ceea79af5eb91a07ce97cd32f221 4.28kB / 4.28kB 0.0s => => extracting sha256:d46336f50433ab27336fad8f9b251b2f68a66d376c902dfca23a6851acae502c 1.4s => => extracting sha256:be961ec6866344c06fe85e53011321da508bc495513bb75a45fc41f6182921b6 0.0s => [internal] load build context 0.3s => => transferring context: 22.66MB 0.3s => [2/6] RUN microdnf install curl ca-certificates java-17-openjdk-headless && microdnf update && microdnf clean all && mkdir /deployments && chown 1001 /deployments && chmod "g+rwX" /deployments && chown 1001:root /deployments && curl 75.7s => [3/6] COPY --chown=1001 build/quarkus-app/lib/ /deployments/lib/ 0.1s => [4/6] COPY --chown=1001 build/quarkus-app/*.jar /deployments/ 0.0s => [5/6] COPY --chown=1001 build/quarkus-app/app/ /deployments/app/ 0.0s => [6/6] COPY --chown=1001 build/quarkus-app/quarkus/ /deployments/quarkus/ 0.0s => exporting to image 2.4s => => exporting layers 2.4s => => writing image sha256:7a4f731341a6d3c9b04e1ffe98783be021280fe109fea48425fe49cb983cf860 0.0s => => naming to docker.io/quarkus/hobby-jvm 0.0s``` shogo.nakao@localhost:(main*) $ docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/hobby-jvm exec java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -XX:+ExitOnOutOfMemoryError -cp . -jar /deployments/quarkus-run.jar Listening for transport dt_socket at address: 5005 __ ____ __ _____ ___ __ ____ ______ --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \ --\___\_\____/_/ |_/_/|_/_/|_|\____/___/ 2021-12-20 14:04:51,601 INFO [io.quarkus] (main) hobby v1.0.0 on JVM (powered by Quarkus 2.5.1.Final) started in 1.055s. Listening on: http://0.0.0.0:8080 2021-12-20 14:04:51,602 INFO [io.quarkus] (main) Profile prod activated. 2021-12-20 14:04:51,603 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-validator, jdbc-mysql, mybatis, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, vertx] ^C2021-12-20 14:05:17,653 INFO [io.quarkus] (Shutdown thread) hobby stopped in 0.036s shogo.nakao@localhost:(main*) $ docker run -i --rm -p 8080:8080 quarkus/hobby-jvm exec java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+ExitOnOutOfMemoryError -cp . -jar /deployments/quarkus-run.jar __ ____ __ _____ ___ __ ____ ______ --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \ --\___\_\____/_/ |_/_/|_/_/|_|\____/___/ 2021-12-20 14:05:21,306 INFO [io.quarkus] (main) hobby v1.0.0 on JVM (powered by Quarkus 2.5.1.Final) started in 0.982s. Listening on: http://0.0.0.0:8080 2021-12-20 14:05:21,307 INFO [io.quarkus] (main) Profile prod activated. 2021-12-20 14:05:21,307 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-validator, jdbc-mysql, mybatis, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
debug on で 1.055s,debug offで0.982sです。もちろんサイズが小さいこともありますが、、、早すぎじゃないですか?
続いてnativeです。初回でエラーが出る方は、sdk man でgraalVMを入れて下さい。
Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
そして待ちに待ったnative compile開始!!
...
......
.........
compileできなかった。。。
なんと、、、recordクラスに対応していなかった、mybatisも対応していなかった。。
どうやらissuesで21.3.0.r17でrecordクラスどうにかして欲しいみたいなのを見つけた。
https://github.com/quarkusio/quarkus/issues/20891
くっそう。。。悲しい、、、
できた瞬間、速攻ためそう。
最後に、弊社では採用もバシバシ実施しているので興味のあるかたがいましたらご応募ください。
Advent Calendar 2021を引き続き楽しんでいただけると嬉しいです。