From 2bb3beef60ce2f0ffe6768a992d42e4f0937e4b9 Mon Sep 17 00:00:00 2001 From: Wanja Krah Date: Mon, 26 Oct 2026 22:53:35 +0100 Subject: [PATCH] turned into a quarkus application --- .dockerignore | 5 +++ Dockerfile | 13 +++++++ README.md | 37 ++++++++++++++++++- agiledancers-be/pom.xml | 36 +++++++++++++++++- .../src/main/resources/application.properties | 2 + .../nl/agilecc/agiledancers/HealthTest.java | 18 +++++++++ pom.xml | 18 +++++---- 7 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 agiledancers-be/src/main/resources/application.properties create mode 100644 agiledancers-be/src/test/java/nl/agilecc/agiledancers/HealthTest.java diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..85df4cf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +**/target +.git +.idea +.mvn +*.iml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b348173 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM maven:3.9-eclipse-temurin-25 AS build +WORKDIR /workspace +COPY pom.xml ./ +COPY agiledancers-be/pom.xml agiledancers-be/pom.xml +COPY agiledancers-be/src agiledancers-be/src +RUN mvn -B -ntp clean verify + +FROM eclipse-temurin:25-jre +WORKDIR /app +COPY --from=build --chown=10001:10001 /workspace/agiledancers-be/target/quarkus-app/ ./ +USER 10001:10001 +EXPOSE 8080 +ENTRYPOINT ["java", "-jar", "/app/quarkus-run.jar"] diff --git a/README.md b/README.md index f14e838..a48de3f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # agiledancers -To map dance groups to performance days. +To map dance groups to performance days. The backend runs on Quarkus with Java 25. Requires JDK 25 and Maven 3.9.0 or newer. Set `JAVA_HOME` to your JDK 25 installation. @@ -9,3 +9,38 @@ Build and run all tests (including `*Sit` tests) from the repository root: ```sh mvn clean verify ``` + +Start development mode with live reload from the repository root: + +```sh +mvn -pl agiledancers-be quarkus:dev +``` + +Run the packaged application after building: + +```sh +java -jar agiledancers-be/target/quarkus-app/quarkus-run.jar +``` + +Build and run a Docker container from the repository root (only Docker is required): + +```sh +docker build -t agiledancers . +docker run --rm --name agiledancers -p 8080:8080 agiledancers +``` + +The Docker build compiles the application and runs the tests in a Maven build stage, +then copies the Quarkus application into a Java 25 runtime image running as a non-root user. + +Check readiness at or overall health at +. For example: + +```sh +curl --fail http://localhost:8080/q/health/ready +``` + +Quarkus configuration can be overridden with environment variables, for example +`docker run --rm -e QUARKUS_HTTP_PORT=9090 -p 9090:9090 agiledancers`. + +The domain services and repositories retain their existing in-memory behavior; +data is lost when the process stops. Business REST endpoints have not yet been added. diff --git a/agiledancers-be/pom.xml b/agiledancers-be/pom.xml index 26611a6..3ef9b6f 100644 --- a/agiledancers-be/pom.xml +++ b/agiledancers-be/pom.xml @@ -14,12 +14,26 @@ jar + + io.quarkus + quarkus-smallrye-health + com.google.ortools ortools-java + + io.quarkus + quarkus-junit + test + + + io.rest-assured + rest-assured + test + net.datafaker datafaker @@ -33,4 +47,24 @@ - \ No newline at end of file + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + + + diff --git a/agiledancers-be/src/main/resources/application.properties b/agiledancers-be/src/main/resources/application.properties new file mode 100644 index 0000000..5265d44 --- /dev/null +++ b/agiledancers-be/src/main/resources/application.properties @@ -0,0 +1,2 @@ +quarkus.application.name=agiledancers +quarkus.http.host=0.0.0.0 diff --git a/agiledancers-be/src/test/java/nl/agilecc/agiledancers/HealthTest.java b/agiledancers-be/src/test/java/nl/agilecc/agiledancers/HealthTest.java new file mode 100644 index 0000000..04130b4 --- /dev/null +++ b/agiledancers-be/src/test/java/nl/agilecc/agiledancers/HealthTest.java @@ -0,0 +1,18 @@ +package nl.agilecc.agiledancers; + +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.equalTo; + +@QuarkusTest +class HealthTest { + @Test + void applicationIsReady() { + given() + .when().get("/q/health/ready") + .then().statusCode(200) + .body("status", equalTo("UP")); + } +} diff --git a/pom.xml b/pom.xml index 0060fc9..348dee4 100644 --- a/pom.xml +++ b/pom.xml @@ -22,18 +22,25 @@ 25 UTF-8 UTF-8 + 3.40.1 9.15.6755 1.18.48 2.7.0 - 6.1.3 + + io.quarkus.platform + quarkus-bom + ${quarkus.platform.version} + pom + import + com.google.ortools ortools-java @@ -48,12 +55,6 @@ test - - org.junit.jupiter - junit-jupiter - ${junit-jupiter.version} - test - @@ -88,6 +89,9 @@ maven-surefire-plugin 3.6.1 + + org.jboss.logmanager.LogManager + **/Test*.java **/*Test.java