r/SpringBoot • u/brainiac_nerd • Jun 16 '24
Spring Into Docker: Containerizing Your Application Effectively
Learn how to effectively containerize a Spring Boot application using Docker and Docker Compose for streamlined deployment and scalability
spring #springboot #docker #dockercompose
23
Upvotes
4
u/swissbuechi Jun 16 '24 edited Jun 16 '24
Please add a disclaimer that the
Dockerfileyou've created only should be used for development.The following best practices should be considered if you want to run a spring docker container in production:
Do not run as root
Minimal packages
Multiple stages (build / run)
Healthcheck
JVM options for enhanced security
This would look something like example below. It's from an older project of mine, where I compared spring via jre vs spring native performance and ressource utilization.
https://github.com/swissbuechi/spring-native-demo
Dockerfile