1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-07-02 06:22:55 +00:00

feat: add Dockerfile for build within docker environment and run application within a container.

This commit is contained in:
Jakub Lidke
2023-08-02 15:19:38 +02:00
parent db631fbd8e
commit a075f73162
3 changed files with 60 additions and 2 deletions

20
HealthCheck.java Normal file
View File

@ -0,0 +1,20 @@
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse.BodyHandlers;
public class HealthCheck {
public static void main(String[] args) throws InterruptedException, IOException {
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8001/actuator/health"))
.header("accept", "application/json")
.build();
var response = client.send(request, BodyHandlers.ofString());
if (response.statusCode() != 200 || !response.body().contains("UP")) {
throw new RuntimeException("Healthcheck failed");
}
}
}