Spring Boot Server
This server was generated by the swagger-codegen project.
By using the OpenAPI-Spec, you can easily generate a server stub.
This is an example of building a swagger-enabled server in Java using the SpringBoot framework.
The underlying library integrating swagger to SpringBoot is springfox
Start your server as an simple java application
You can view the api documentation in swagger-ui by pointing to
http://localhost:8080/
Change default port value in application.properties
- Using maven to build the application jar
mvn package
- Run the application locally
cd target; java -jar appname-version.jar
- Build docker image
mvn package docker:build
- Run the build docker image
# look up prefix/artifactId at pom.xml (at docker-maven-plugin configuration block)
sudo docker run -p 8080:8080 -d prefix/artifactId
# view logs
sudo docker logs prefix/artifactId
# bash into the container
sudo docker exec -it prefix/artifactId bash
- Build and push the image to docker registry
# if not yet done, login first
sudo docker login
# TBD save docker registry credentials to some config file
# main command
mvn package docker:build docker:push
# or alternatively
sudo docker push prefix/artifactId:latest
should provide proper documentation on how to deploy to production
- docker-maven-plugin documentation https://dmp.fabric8.io/#introduction
- example https://dzone.com/articles/running-spring-boot-in-a-docker-container