-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] Build and publish application hosted in the repository for th…
…e Java instrumentation E2E test (#2094) * Build and publish the Java E2E image Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix the tags Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix the tags Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Use reusable workflow Signed-off-by: Israel Blancas <iblancasa@gmail.com> --------- Signed-off-by: Israel Blancas <iblancasa@gmail.com>
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.example.app; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
|
||
@RestController | ||
@SpringBootApplication | ||
public class DemoApplication { | ||
|
||
@RequestMapping("/") | ||
String home() { | ||
return "Hello World!"; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(DemoApplication.class, args); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM --platform=$BUILDPLATFORM eclipse-temurin:17-jdk-focal as builder | ||
|
||
RUN apt update | ||
RUN apt install zip unzip -y | ||
|
||
RUN mkdir /app | ||
|
||
# In some archs, there could be probems setting the executable permissions | ||
RUN mkdir /app/.gradle | ||
RUN chmod -R +x /root/ | ||
|
||
RUN curl -s "https://get.sdkman.io" | bash | ||
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install springboot && spring init /app" | ||
|
||
WORKDIR /app | ||
COPY DemoApplication.java /app/src/main/java/com/example/app/ | ||
COPY build.gradle . | ||
RUN ./gradlew bootJar --no-daemon | ||
|
||
FROM eclipse-temurin:17.0.8.1_1-jre | ||
|
||
COPY --from=builder /app/build/libs/app-0.0.1-SNAPSHOT.jar . | ||
ENTRYPOINT ["java", "-jar", "app-0.0.1-SNAPSHOT.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.1.3' | ||
id 'io.spring.dependency-management' version '1.1.3' | ||
} | ||
|
||
group = 'com.example' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = '17' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-web-test' | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
} |