S19: establish engineering repository
This commit is contained in:
7
templates/backend/.dockerignore
Normal file
7
templates/backend/.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.git
|
||||
**/node_modules
|
||||
ci/artifacts
|
||||
**/target
|
||||
!backend/target
|
||||
backend/target/*
|
||||
!backend/target/quarkus-app
|
||||
13
templates/backend/Dockerfile
Normal file
13
templates/backend/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM maven:3.9-eclipse-temurin-25 AS build
|
||||
WORKDIR /workspace
|
||||
COPY . .
|
||||
RUN mvn -B -ntp -Dformat.mode=check clean verify
|
||||
FROM eclipse-temurin:25-jre AS runtime
|
||||
WORKDIR /app
|
||||
USER 10001:10001
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java", "-jar", "/app/quarkus-run.jar"]
|
||||
FROM runtime AS prebuilt
|
||||
COPY --chown=10001:10001 backend/target/quarkus-app/ ./
|
||||
FROM runtime AS standalone
|
||||
COPY --from=build --chown=10001:10001 /workspace/backend/target/quarkus-app/ ./
|
||||
99
templates/backend/backend/pom.xml
Normal file
99
templates/backend/backend/pom.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.example.@PROJECT@</groupId>
|
||||
<artifactId>@PROJECT@</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>backend</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-jacoco</artifactId><scope>test</scope></dependency>
|
||||
<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-rest-jackson</artifactId></dependency>
|
||||
<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-smallrye-health</artifactId></dependency>
|
||||
<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-junit</artifactId><scope>test</scope></dependency>
|
||||
<dependency><groupId>io.rest-assured</groupId><artifactId>rest-assured</artifactId><scope>test</scope></dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>3.8.1</version>
|
||||
<executions><execution><id>standards-classpath</id><phase>prepare-package</phase><goals><goal>build-classpath</goal></goals>
|
||||
<configuration><outputFile>${project.build.directory}/standards-classpath.txt</outputFile></configuration>
|
||||
</execution>
|
||||
<execution><id>coverage-tools</id><phase>prepare-package</phase><goals><goal>copy</goal></goals>
|
||||
<configuration><artifactItems>
|
||||
<artifactItem><groupId>org.jacoco</groupId><artifactId>org.jacoco.agent</artifactId><version>0.8.14</version><classifier>runtime</classifier><destFileName>agent.jar</destFileName></artifactItem>
|
||||
<artifactItem><groupId>org.jacoco</groupId><artifactId>org.jacoco.cli</artifactId><version>0.8.14</version><classifier>nodeps</classifier><destFileName>cli.jar</destFileName></artifactItem>
|
||||
</artifactItems><outputDirectory>${project.build.directory}/coverage-tools</outputDirectory></configuration>
|
||||
</execution></executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>3.6.3</version>
|
||||
<executions><execution><id>standards</id><phase>verify</phase><goals><goal>exec</goal></goals>
|
||||
<configuration>
|
||||
<executable>${maven.home}/bin/mvn</executable>
|
||||
<workingDirectory>${maven.multiModuleProjectDirectory}</workingDirectory>
|
||||
<arguments><argument>-B</argument><argument>-ntp</argument><argument>-f</argument>
|
||||
<argument>${maven.multiModuleProjectDirectory}/generated/tooling/standards/pom.xml</argument>
|
||||
<argument>test</argument><argument>exec:java</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution><id>coverage</id><phase>verify</phase><goals><goal>exec</goal></goals>
|
||||
<configuration><executable>${java.home}/bin/java</executable><arguments>
|
||||
<argument>${maven.multiModuleProjectDirectory}/generated/tooling/coverage/Coverage.java</argument>
|
||||
<argument>${project.build.directory}/site/jacoco/jacoco.xml</argument>
|
||||
</arguments></configuration>
|
||||
</execution>
|
||||
<execution><id>combined-coverage</id><phase>none</phase><goals><goal>exec</goal></goals>
|
||||
<configuration><executable>${java.home}/bin/java</executable><arguments>
|
||||
<argument>${maven.multiModuleProjectDirectory}/generated/tooling/coverage/Coverage.java</argument>
|
||||
<argument>${project.build.directory}/site/jacoco-combined/jacoco.xml</argument>
|
||||
</arguments></configuration>
|
||||
</execution></executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId><artifactId>jacoco-maven-plugin</artifactId><version>0.8.14</version>
|
||||
<executions>
|
||||
<execution><id>agent</id><goals><goal>prepare-agent</goal></goals><configuration>
|
||||
<exclClassLoaders>*QuarkusClassLoader</exclClassLoaders><destFile>${project.build.directory}/jacoco.exec</destFile><append>true</append>
|
||||
</configuration></execution>
|
||||
<execution><id>report</id><phase>post-integration-test</phase><goals><goal>report</goal></goals></execution>
|
||||
<execution><id>combined</id><phase>none</phase><goals><goal>merge</goal></goals><configuration>
|
||||
<fileSets><fileSet><directory>${project.build.directory}</directory><includes><include>jacoco.exec</include><include>playwright.exec</include></includes></fileSet></fileSets>
|
||||
<destFile>${project.build.directory}/jacoco-combined.exec</destFile>
|
||||
</configuration></execution>
|
||||
<execution><id>combined-report</id><phase>none</phase><goals><goal>report</goal></goals><configuration>
|
||||
<dataFile>${project.build.directory}/jacoco-combined.exec</dataFile>
|
||||
<outputDirectory>${project.build.directory}/site/jacoco-combined</outputDirectory>
|
||||
</configuration></execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-maven-plugin</artifactId>
|
||||
<version>${quarkus.platform.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
<goal>generate-code</goal>
|
||||
<goal>generate-code-tests</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.example;
|
||||
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
|
||||
/** Minimal endpoint for the generated recipe. */
|
||||
@Path("/hello")
|
||||
public class GreetingResource {
|
||||
/** Return the starter greeting. */
|
||||
@GET
|
||||
public String hello() {
|
||||
return "Hello";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
quarkus.http.host=0.0.0.0
|
||||
%test.quarkus.jacoco.data-file=target/jacoco.exec
|
||||
%test.quarkus.jacoco.reuse-data-file=true
|
||||
%test.quarkus.jacoco.report=false
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.example;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Exercise the starter over HTTP. */
|
||||
@QuarkusTest
|
||||
public class GreetingResourceTest {
|
||||
@Test
|
||||
public void returnsGreeting() {
|
||||
given().when().get("/hello").then().statusCode(200).body(is("Hello"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user