Vorbereitung Release 0.2.0
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
!build/*-runner
|
||||
!build/*-runner.jar
|
||||
!build/lib/*
|
||||
!build/quarkus-app/*
|
||||
!build/quarkus-app/*
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# ----------------------------------------------------------------------- #
|
||||
FROM gradle:9.2-jdk AS builder
|
||||
WORKDIR /
|
||||
COPY ./src/ ./src/
|
||||
COPY ./build.gradle.kts ./
|
||||
COPY ./gradle.properties ./
|
||||
COPY ./settings.gradle.kts ./
|
||||
RUN gradle build --no-daemon
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
#FROM alpine/java:21-jdk AS run
|
||||
|
||||
#RUN adduser --system appuser
|
||||
|
||||
#COPY --from=builder --chown=appuser:appuser /build/libs/kontor-quarkus-0.2.0-SNAPSHOT.jar app.jar
|
||||
|
||||
#EXPOSE 8800
|
||||
#USER appuser
|
||||
#CMD ["java", "-jar", "-Dquarkus.http.host=0.0.0.0", "app.jar"]
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
|
||||
|
||||
ENV LANGUAGE='en_US:en'
|
||||
|
||||
# We make four distinct layers so if there are application changes the library layers can be re-used
|
||||
COPY --from=builder --chown=185 build/quarkus-app/lib/ /deployments/lib/
|
||||
COPY --from=builder --chown=185 build/quarkus-app/*.jar /deployments/
|
||||
COPY --from=builder --chown=185 build/quarkus-app/app/ /deployments/app/
|
||||
COPY --from=builder --chown=185 build/quarkus-app/quarkus/ /deployments/quarkus/
|
||||
|
||||
EXPOSE 8800
|
||||
USER 185
|
||||
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
|
||||
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
|
||||
|
||||
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
|
||||
@@ -0,0 +1,57 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.2.21"
|
||||
kotlin("plugin.allopen") version "2.2.21"
|
||||
id("io.quarkus")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
val quarkusPlatformGroupId: String by project
|
||||
val quarkusPlatformArtifactId: String by project
|
||||
val quarkusPlatformVersion: String by project
|
||||
|
||||
dependencies {
|
||||
implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
|
||||
implementation("io.quarkus:quarkus-container-image-docker")
|
||||
implementation("io.quarkus:quarkus-rest-jackson")
|
||||
implementation("io.quarkus:quarkus-kotlin")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
implementation("io.quarkus:quarkus-arc")
|
||||
implementation("io.quarkus:quarkus-rest")
|
||||
implementation("io.quarkus:quarkus-smallrye-openapi")
|
||||
implementation("io.quarkus:quarkus-smallrye-health")
|
||||
implementation("io.quarkus:quarkus-hibernate-orm-panache-kotlin")
|
||||
implementation("io.quarkus:quarkus-jdbc-h2")
|
||||
implementation("io.quarkus:quarkus-jdbc-postgresql")
|
||||
testImplementation("io.quarkus:quarkus-junit5")
|
||||
testImplementation("io.rest-assured:rest-assured")
|
||||
}
|
||||
|
||||
group = "de.thpeetz"
|
||||
version = "0.2.0-SNAPSHOT"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
systemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager")
|
||||
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
|
||||
}
|
||||
allOpen {
|
||||
annotation("jakarta.ws.rs.Path")
|
||||
annotation("jakarta.enterprise.context.ApplicationScoped")
|
||||
annotation("jakarta.persistence.Entity")
|
||||
annotation("io.quarkus.test.junit.QuarkusTest")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
|
||||
javaParameters = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
pluginManagement {
|
||||
val quarkusPluginVersion: String by settings
|
||||
val quarkusPluginId: String by settings
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
mavenLocal()
|
||||
}
|
||||
plugins {
|
||||
id(quarkusPluginId) version quarkusPluginVersion
|
||||
}
|
||||
}
|
||||
rootProject.name="kontor-quarkus"
|
||||
@@ -0,0 +1,14 @@
|
||||
package de.thpeetz
|
||||
|
||||
import jakarta.ws.rs.GET
|
||||
import jakarta.ws.rs.Path
|
||||
import jakarta.ws.rs.Produces
|
||||
import jakarta.ws.rs.core.MediaType
|
||||
|
||||
@Path("/hello")
|
||||
class GreetingResource {
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
fun hello() = "Hello from Quarkus REST"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package de.thpeetz.kontor
|
||||
|
||||
import jakarta.ws.rs.core.Application
|
||||
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition
|
||||
import org.eclipse.microprofile.openapi.annotations.info.Info
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag
|
||||
|
||||
@OpenAPIDefinition(
|
||||
info = Info(
|
||||
title = "Kontor",
|
||||
version = "0.2.0"
|
||||
)
|
||||
)
|
||||
class KontorApplication: Application()
|
||||
@@ -0,0 +1,25 @@
|
||||
package de.thpeetz.kontor.comics.domain
|
||||
|
||||
import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntityBase
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.Id
|
||||
import jakarta.persistence.Table
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@Entity
|
||||
@Table(name = "comic")
|
||||
class Comic: PanacheEntityBase {
|
||||
@Id
|
||||
lateinit var id: String
|
||||
lateinit var createdDate: LocalDateTime
|
||||
lateinit var lastModifiedDate: LocalDateTime
|
||||
lateinit var version: Integer
|
||||
lateinit var title: String
|
||||
lateinit var webLink: String
|
||||
var completed: Boolean = false
|
||||
var currentOrder: Boolean = false
|
||||
lateinit var publisherId: String
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package de.thpeetz.kontor.comics.resource
|
||||
|
||||
import de.thpeetz.kontor.comics.domain.Comic
|
||||
import jakarta.ws.rs.GET
|
||||
import jakarta.ws.rs.Path
|
||||
import jakarta.ws.rs.PathParam
|
||||
import jakarta.ws.rs.Produces
|
||||
import jakarta.ws.rs.core.MediaType
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag
|
||||
|
||||
@Path("/api/comics/comics")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "comics", description = "Comics")
|
||||
class ComicsResource {
|
||||
|
||||
@GET
|
||||
fun findAll(): List<Comic> = emptyList<Comic>()
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
fun findById(@PathParam("id") id: String): Comic? = null
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
quarkus.http.port=8800
|
||||
quarkus.swagger-ui.always-include=true
|
||||
quarkus.datasource.db-kind=postgresql
|
||||
quarkus.datasource.username=kontor
|
||||
quarkus.datasource.password=kontor
|
||||
quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/kontor
|
||||
#prod
|
||||
%prod.quarkus.datasource.db-kind=postgresql
|
||||
%prod.quarkus.datasource.username=kontor
|
||||
%prod.quarkus.datasource.password=kontor
|
||||
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/kontor
|
||||
# dev
|
||||
%dev.quarkus.datasource.db-kind=h2
|
||||
%dev.quarkus.datasource.username=sa
|
||||
%dev.quarkus.datasource.password=password
|
||||
%dev.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb
|
||||
%dev.quarkus.hibernate-orm.database.generation=update
|
||||
# test
|
||||
%test.quarkus.datasource.db-kind=h2
|
||||
%test.quarkus.datasource.username=sa
|
||||
%test.quarkus.datasource.password=password
|
||||
%test.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb
|
||||
%test.quarkus.hibernate-orm.database.generation=update
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.thpeetz
|
||||
|
||||
import io.quarkus.test.junit.QuarkusIntegrationTest
|
||||
|
||||
@QuarkusIntegrationTest
|
||||
class GreetingResourceIT : GreetingResourceTest()
|
||||
@@ -0,0 +1,20 @@
|
||||
package de.thpeetz
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest
|
||||
import io.restassured.RestAssured.given
|
||||
import org.hamcrest.CoreMatchers.`is`
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@QuarkusTest
|
||||
class GreetingResourceTest {
|
||||
|
||||
@Test
|
||||
fun testHelloEndpoint() {
|
||||
given()
|
||||
.`when`().get("/hello")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(`is`("Hello from Quarkus REST"))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user