diff --git a/Dockerfile b/Dockerfile index 736ed63..8e13285 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ USER app # Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies COPY --chown=app ${SERVICE_ROOT}/gradle/ ./gradle -COPY --chown=app ${SERVICE_ROOT}/gradlew ${SERVICE_ROOT}/build.gradle ${SERVICE_ROOT}/settings.gradle ./ +COPY --chown=app ${SERVICE_ROOT}/gradlew ${SERVICE_ROOT}/build.gradle ${SERVICE_ROOT}/settings.gradle ${SERVICE_ROOT}/app.json ./ # Copy all needed project files to a folder COPY --chown=app:app ${SERVICE_ROOT}/src ./src diff --git a/app.json b/app.json new file mode 100644 index 0000000..eaa7b70 --- /dev/null +++ b/app.json @@ -0,0 +1,15 @@ +{ + "healthchecks": { + "web": [ + { + "type": "readiness", + "name": "web check", + "description": "Checking if the app responds to the /actuator/health/readiness endpoint", + "path": "/actuator/health/readiness", + "initialDelay": 20, + "port": 8080, + "attempts": 3 + } + ] + } +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 3036d59..72d7f23 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -14,6 +14,12 @@ info: spring-cloud-version: '@spring-cloud.version@' spring-boot-version: '@project.parent.version@' +management: + endpoint: + health: + probes: + enabled: true + server: port: ${PORT:8080} shutdown: graceful