Skip to content

Instantly share code, notes, and snippets.

@pavankjadda
Last active August 21, 2020 21:24
Show Gist options
  • Save pavankjadda/cb5cf74f9367595b00167c54edcb0a86 to your computer and use it in GitHub Desktop.
Save pavankjadda/cb5cf74f9367595b00167c54edcb0a86 to your computer and use it in GitHub Desktop.
Docker Health Check.md
## Use OpenJDK 11 slim image
FROM adoptopenjdk:11-jre-openj9-bionic

### Copy JAR file from local machine to container
COPY target/*.jar app.jar

### Expose the port
EXPOSE 8080

### Health check endpoint
HEALTHCHECK --start-period=2m --interval=30s --timeout=5s CMD curl -f http://localhost:8080/api/v1/health/find/status | grep UP || exit 1

### Start the Spring Boot application
CMD ["java","-jar","app.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment