From 31ad26a9d7776a334abbdf87752ed1ecdbdec8bd Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Sat, 23 Aug 2025 00:11:47 +0200 Subject: [PATCH] optimize setup Signed-off-by: Peter Siegmund --- Dockerfile | 4 ++-- build.gradle | 19 ++++++++++++------- src/main/resources/application-dev.yaml | 2 -- src/main/resources/application-test.yaml | 0 src/main/resources/application.yaml | 3 --- src/main/resources/bootstrap.yml | 16 ++++++++++++++++ 6 files changed, 30 insertions(+), 14 deletions(-) delete mode 100644 src/main/resources/application-dev.yaml delete mode 100644 src/main/resources/application-test.yaml delete mode 100644 src/main/resources/application.yaml create mode 100644 src/main/resources/bootstrap.yml diff --git a/Dockerfile b/Dockerfile index 8bad464..c42c71f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ USER app # Copy all needed project files to a folder COPY --chown=app ./gradle/ ./gradle -COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./app.json ./ +COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./ COPY --chown=app ./src ./src RUN curl -OL https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar @@ -28,6 +28,6 @@ USER app COPY --chown=app --from=build /usr/src/app/build/libs/*-SNAPSHOT.jar /usr/app/google.jar COPY --chown=app --from=build /usr/src/app/opentelemetry-javaagent.jar /usr/app/opentelemetry-javaagent.jar -HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health/liveness || exit 1 +HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health || exit 1 CMD ["java", "-jar", "/usr/app/google.jar"] diff --git a/build.gradle b/build.gradle index b3798fa..b7323b1 100644 --- a/build.gradle +++ b/build.gradle @@ -30,22 +30,27 @@ ext { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.boot:spring-boot-starter-webflux' + annotationProcessor 'org.projectlombok:lombok' + developmentOnly 'org.springframework.boot:spring-boot-devtools' implementation 'com.google.cloud:spring-cloud-gcp-starter' implementation 'com.google.cloud:spring-cloud-gcp-starter-storage' - implementation 'org.springframework.modulith:spring-modulith-starter-core' + implementation 'com.nimbusds:nimbus-jose-jwt:9.41.1' implementation 'io.grpc:grpc-netty' implementation 'io.netty:netty-all' - developmentOnly 'org.springframework.boot:spring-boot-devtools' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-webflux' + implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' + implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j' + implementation 'org.springframework.cloud:spring-cloud-starter-config' + implementation 'org.springframework.cloud:spring-cloud-starter-gateway' + implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' + implementation 'org.springframework.modulith:spring-modulith-starter-core' runtimeOnly 'org.springframework.modulith:spring-modulith-actuator' runtimeOnly 'org.springframework.modulith:spring-modulith-observability' - annotationProcessor 'org.projectlombok:lombok' - testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.modulith:spring-modulith-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - implementation 'com.nimbusds:nimbus-jose-jwt:9.41.1' } dependencyManagement { diff --git a/src/main/resources/application-dev.yaml b/src/main/resources/application-dev.yaml deleted file mode 100644 index 2545e37..0000000 --- a/src/main/resources/application-dev.yaml +++ /dev/null @@ -1,2 +0,0 @@ -server: - port: 8096 diff --git a/src/main/resources/application-test.yaml b/src/main/resources/application-test.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml deleted file mode 100644 index 3d3bff8..0000000 --- a/src/main/resources/application.yaml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - application: - name: google-service diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..1e1c0d3 --- /dev/null +++ b/src/main/resources/bootstrap.yml @@ -0,0 +1,16 @@ +eureka: + client: + fetch-registry: true + register-with-eureka: true + service-url: + defaultZone: ${EUREKA} + +spring: + application: + name: google-service + cloud: + config: + discovery: + enabled: true + serviceId: config-service + fail-fast: true