Maven archetype to create a docker-configured maven project for Spring Boot Application
with Bash
mvn archetype:generate\
-DarchetypeGroupId=am.ik.archetype\
-DarchetypeArtifactId=spring-boot-docker-blank-archetype\
-DarchetypeVersion=1.0.5
with CommandPrompt (Windows)
mvn archetype:generate^
-DarchetypeGroupId=am.ik.archetype^
-DarchetypeArtifactId=spring-boot-docker-blank-archetype^
-DarchetypeVersion=1.0.5
$ mvn archetype:generate -B\
-DarchetypeGroupId=am.ik.archetype\
-DarchetypeArtifactId=spring-boot-docker-blank-archetype\
-DarchetypeVersion=1.0.5\
-DgroupId=com.example\
-DartifactId=hajiboot\
-Dversion=1.0.0-SNAPSHOT
$ mvn clean package
$ cd target
$ sudo docker build -t spring-boot-docker-demo .
$ sudo docker run -p 8080:8080 -t spring-boot-docker-demo
Access http://localhost:8080
At target
directory after mvn package
, you can find app.zip
.
This file has been created automatically like following
$ zip app.zip Dockerfile Dockerrun.aws.json *.jar
Go to "AWS Elastic Beanstalk Management Console".
Change the platform to "Docker".
Wait a few minutes until the default environment is created.
when the "Health" gets "Green", your environment is ready.
Then, select app.zip
you've just created and enter the application version.
Click "Deploy".
After your app is deployed, the "Health" will get "Green" again.
Access the endpoint (default-environment-XXXXXXXX.elasticbeanstalk.com), you can meet "Hello World!".
You can also know the environment info using "Spring Boot Actuator" :-)
Licensed under the Apache License, Version 2.0.