You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Lightweight Spring Boot Docker image based on Alpine + Docker Compose file
Features:
Spring profiles
Custom JAVA_OPTS
Healthcheck
Wrapper script that enables application to take PID 1 & receive SIGTERM signals
Debug mode
This tag integrates an healthcheck feature to tell Docker how to check the status of the container. This feature simply executes an HTTP request to a given URL: ${SERVER_PROTOCOL}://localhost:${SERVER_PORT}/${HEALTHCHECK_CONTEXT}
Available environment variables
Name
Default
Description
DEBUG
false
Enable or disable debug mode
DEBUG_PORT
8000
Debug port
SPRING_PROFILES_ACTIVE
dev
Active Spring profiles
JAVA_OPTS
JAVA_OPTS
SERVER_PROTOCOL
http
Spring Boot application server protocol, picked by the healthcheck command to check the application status
SERVER_PORT
8080
Spring Boot application server port (server.port), picked by the healthcheck command to check the application status
HEALTHCHECK_CONTEXT
/
The context URL to check the application status, picked by the healthcheck command to check the application status
How to use ?
Simply extend your image from flopes/spring-boot-docker and set your application name as an environment variable:
FROM flopes/spring-boot-docker:1.0
ENV ARTIFACT_NAME my-spring-boot-application.jar
Copy your Spring Boot executable jar into an assets folder and build you image:
docker build -t spring-boot-image .
Start your application:
Using Docker CLI
Using the provided docker-compose.yml in this repository:
docker-compose up -d
Inject environment variables:
docker run -d -p 8080:8080 -e JAVA_OPTS=-Xms256m -Xmx512m spring-boot-image
Using Docker Compose
The docker-compose.yml file picks its configuration from the .env one.
Using this file, you can set the desired properties: