From 139048ddda29bb1d83b135e049ab0810adfb2d2c Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Sat, 25 Nov 2023 17:00:35 +0100 Subject: [PATCH] Enhance Quarkus sample project - Fix container image name - Fix static resources location for serving in application.jar --- demo/sample-quarkus/README.md | 4 +- demo/sample-quarkus/pom.xml | 1 + .../src/main/docker/Dockerfile.jvm | 6 +-- .../src/main/docker/Dockerfile.legacy-jar | 6 +-- .../src/main/docker/Dockerfile.native | 4 +- .../src/main/docker/Dockerfile.native-micro | 4 +- .../apache/camel/demo/StaticResources.java | 40 ------------------ .../assets/fonts/webfonts/fa-solid-900.woff | Bin .../assets/fonts/webfonts/fa-solid-900.woff2 | Bin .../resources}/scripts/jquery-3.3.1.min.js | 0 .../resources}/styles/patternfly.css | 0 .../src/main/resources/application.properties | 1 + .../src/test/resources/openapi.json | 2 +- 13 files changed, 15 insertions(+), 53 deletions(-) delete mode 100644 demo/sample-quarkus/src/main/java/org/apache/camel/demo/StaticResources.java rename demo/sample-quarkus/src/main/resources/{ => META-INF/resources}/assets/fonts/webfonts/fa-solid-900.woff (100%) rename demo/sample-quarkus/src/main/resources/{ => META-INF/resources}/assets/fonts/webfonts/fa-solid-900.woff2 (100%) rename demo/sample-quarkus/src/main/resources/{ => META-INF/resources}/scripts/jquery-3.3.1.min.js (100%) rename demo/sample-quarkus/src/main/resources/{ => META-INF/resources}/styles/patternfly.css (100%) diff --git a/demo/sample-quarkus/README.md b/demo/sample-quarkus/README.md index 0add9979..f136f76e 100644 --- a/demo/sample-quarkus/README.md +++ b/demo/sample-quarkus/README.md @@ -266,7 +266,7 @@ Or, if you don't have GraalVM installed, you can run the native executable build ./mvnw package -Dnative -Dquarkus.native.container-build=true ``` -You can then execute your native executable with: `./target/kamelets-quarkus-demo-1.0.0-runner` +You can then execute your native executable with: `./target/food-market-demo-1.1.0-runner` If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling. @@ -281,7 +281,7 @@ To build your image, run: You can push your image using: ```shell script -docker push quay.io/{YOUR_USERNAME}/food-market-demo:1.0.0 +docker push quay.io/{YOUR_USERNAME}/food-market-demo:1.1.0 ``` ## Related Guides diff --git a/demo/sample-quarkus/pom.xml b/demo/sample-quarkus/pom.xml index 4750103d..0d418122 100644 --- a/demo/sample-quarkus/pom.xml +++ b/demo/sample-quarkus/pom.xml @@ -155,6 +155,7 @@ + food-market-demo io.quarkus.platform diff --git a/demo/sample-quarkus/src/main/docker/Dockerfile.jvm b/demo/sample-quarkus/src/main/docker/Dockerfile.jvm index 5ad0829e..39e5bc5b 100644 --- a/demo/sample-quarkus/src/main/docker/Dockerfile.jvm +++ b/demo/sample-quarkus/src/main/docker/Dockerfile.jvm @@ -7,11 +7,11 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/kamelets-quarkus-demo-jvm . +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/food-market-demo-jvm . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/kamelets-quarkus-demo-jvm +# docker run -i --rm -p 8080:8080 quarkus/food-market-demo-jvm # # If you want to include the debug port into your docker image # you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. @@ -20,7 +20,7 @@ # # Then run the container using : # -# docker run -i --rm -p 8080:8080 quarkus/kamelets-quarkus-demo-jvm +# docker run -i --rm -p 8080:8080 quarkus/food-market-demo-jvm # # This image uses the `run-java.sh` script to run the application. # This scripts computes the command line to execute your Java application, and diff --git a/demo/sample-quarkus/src/main/docker/Dockerfile.legacy-jar b/demo/sample-quarkus/src/main/docker/Dockerfile.legacy-jar index 0f15007a..9b450dba 100644 --- a/demo/sample-quarkus/src/main/docker/Dockerfile.legacy-jar +++ b/demo/sample-quarkus/src/main/docker/Dockerfile.legacy-jar @@ -7,11 +7,11 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/kamelets-quarkus-demo-legacy-jar . +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/food-market-demo-legacy-jar . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/kamelets-quarkus-demo-legacy-jar +# docker run -i --rm -p 8080:8080 quarkus/food-market-demo-legacy-jar # # If you want to include the debug port into your docker image # you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. @@ -20,7 +20,7 @@ # # Then run the container using : # -# docker run -i --rm -p 8080:8080 quarkus/kamelets-quarkus-demo-legacy-jar +# docker run -i --rm -p 8080:8080 quarkus/food-market-demo-legacy-jar # # This image uses the `run-java.sh` script to run the application. # This scripts computes the command line to execute your Java application, and diff --git a/demo/sample-quarkus/src/main/docker/Dockerfile.native b/demo/sample-quarkus/src/main/docker/Dockerfile.native index aaa46a4b..680b7cf2 100644 --- a/demo/sample-quarkus/src/main/docker/Dockerfile.native +++ b/demo/sample-quarkus/src/main/docker/Dockerfile.native @@ -7,11 +7,11 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native -t quarkus/kamelets-quarkus-demo . +# docker build -f src/main/docker/Dockerfile.native -t quarkus/food-market-demo . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/kamelets-quarkus-demo +# docker run -i --rm -p 8080:8080 quarkus/food-market-demo # ### FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8 diff --git a/demo/sample-quarkus/src/main/docker/Dockerfile.native-micro b/demo/sample-quarkus/src/main/docker/Dockerfile.native-micro index de7a9dcd..db76b44b 100644 --- a/demo/sample-quarkus/src/main/docker/Dockerfile.native-micro +++ b/demo/sample-quarkus/src/main/docker/Dockerfile.native-micro @@ -10,11 +10,11 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/kamelets-quarkus-demo . +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/food-market-demo . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/kamelets-quarkus-demo +# docker run -i --rm -p 8080:8080 quarkus/food-market-demo # ### FROM quay.io/quarkus/quarkus-micro-image:2.0 diff --git a/demo/sample-quarkus/src/main/java/org/apache/camel/demo/StaticResources.java b/demo/sample-quarkus/src/main/java/org/apache/camel/demo/StaticResources.java deleted file mode 100644 index 143e9bbb..00000000 --- a/demo/sample-quarkus/src/main/java/org/apache/camel/demo/StaticResources.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.camel.demo; - -import io.quarkus.runtime.StartupEvent; -import io.vertx.ext.web.Router; -import io.vertx.ext.web.handler.StaticHandler; -import jakarta.enterprise.event.Observes; - -public class StaticResources { - - void installRoute(@Observes StartupEvent startupEvent, Router router) { - router.route() - .path("/scripts/*") - .handler(StaticHandler.create("scripts/")); - - router.route() - .path("/assets/*") - .handler(StaticHandler.create("assets/")); - - router.route() - .path("/styles/*") - .handler(StaticHandler.create("styles/")); - } -} diff --git a/demo/sample-quarkus/src/main/resources/assets/fonts/webfonts/fa-solid-900.woff b/demo/sample-quarkus/src/main/resources/META-INF/resources/assets/fonts/webfonts/fa-solid-900.woff similarity index 100% rename from demo/sample-quarkus/src/main/resources/assets/fonts/webfonts/fa-solid-900.woff rename to demo/sample-quarkus/src/main/resources/META-INF/resources/assets/fonts/webfonts/fa-solid-900.woff diff --git a/demo/sample-quarkus/src/main/resources/assets/fonts/webfonts/fa-solid-900.woff2 b/demo/sample-quarkus/src/main/resources/META-INF/resources/assets/fonts/webfonts/fa-solid-900.woff2 similarity index 100% rename from demo/sample-quarkus/src/main/resources/assets/fonts/webfonts/fa-solid-900.woff2 rename to demo/sample-quarkus/src/main/resources/META-INF/resources/assets/fonts/webfonts/fa-solid-900.woff2 diff --git a/demo/sample-quarkus/src/main/resources/scripts/jquery-3.3.1.min.js b/demo/sample-quarkus/src/main/resources/META-INF/resources/scripts/jquery-3.3.1.min.js similarity index 100% rename from demo/sample-quarkus/src/main/resources/scripts/jquery-3.3.1.min.js rename to demo/sample-quarkus/src/main/resources/META-INF/resources/scripts/jquery-3.3.1.min.js diff --git a/demo/sample-quarkus/src/main/resources/styles/patternfly.css b/demo/sample-quarkus/src/main/resources/META-INF/resources/styles/patternfly.css similarity index 100% rename from demo/sample-quarkus/src/main/resources/styles/patternfly.css rename to demo/sample-quarkus/src/main/resources/META-INF/resources/styles/patternfly.css diff --git a/demo/sample-quarkus/src/main/resources/application.properties b/demo/sample-quarkus/src/main/resources/application.properties index 2528e4fe..28bf7569 100644 --- a/demo/sample-quarkus/src/main/resources/application.properties +++ b/demo/sample-quarkus/src/main/resources/application.properties @@ -16,6 +16,7 @@ quarkus.log.level=INFO quarkus.container-image.registry=quay.io quarkus.container-image.group=citrusframework +quarkus.container-image.name=food-market-demo quarkus.hibernate-orm.database.generation=drop-and-create diff --git a/demo/sample-quarkus/src/test/resources/openapi.json b/demo/sample-quarkus/src/test/resources/openapi.json index 8d9e476f..704da3e9 100644 --- a/demo/sample-quarkus/src/test/resources/openapi.json +++ b/demo/sample-quarkus/src/test/resources/openapi.json @@ -575,4 +575,4 @@ } } } -} \ No newline at end of file +}