Skip to content

Commit 5d45962

Browse files
committed
Add a container health check
See #38.
1 parent fcf6f32 commit 5d45962

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,5 @@ COPY --from=builder application/application/ ./
5959
EXPOSE 8080
6060

6161
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
62+
63+
HEALTHCHECK CMD ["/usr/bin/curl", "--silent", "http://localhost:8080/actuator/health"]

pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@
136136
<artifactId>spring-boot-starter-web</artifactId>
137137
<scope>runtime</scope>
138138
</dependency>
139+
<dependency>
140+
<groupId>org.springframework.boot</groupId>
141+
<artifactId>spring-boot-starter-actuator</artifactId>
142+
<scope>runtime</scope>
143+
</dependency>
139144
<dependency>
140145
<groupId>org.springframework.boot</groupId>
141146
<artifactId>spring-boot-starter-tomcat</artifactId>

src/main/resources/application.properties

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ validator.common = common-beans.xml
88
# Space-separated list of the validator configurations to load.
99
validator.configurations = default-validator.xml \
1010
empty-validator.xml test/validator.xml
11+
12+
# Only expose the spring-boot-actuator health endpoint.
13+
management.endpoints.enabled-by-default=false
14+
management.endpoint.health.enabled=true
15+
# Disable the disk space health indicator
16+
management.health.diskspace.enabled=false

0 commit comments

Comments
 (0)