Deploying Spring Boot Applications to Bluemix
Just 4 steps will get your Spring Boot application with Spring REST set up on IBM Bluemix.
Join the DZone community and get the full member experience.Join For Free
in the previous blog entry i described how to document rest apis in spring boot applications via swagger . below i explain how to deploy these applications as docker containers to ibm bluemix . as example i use again the spring rest sample .
in the dockerfile (in the project root directory) define how to build the docker image.
from java:8 volume /tmp add target/gs-rest-service-0.1.0.jar app.jar run bash -c 'touch /app.jar' entrypoint ["java","-djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
from the root directory invoke the following commands.
mvn package docker build -t gs-rest-service . docker run --name gs-rest-service -p 80:8080 -d -t gs-rest-service
after this you can run the sample in our local docker environment.
in order to push the image to bluemix invoke the following commands.
cf login cf ic login docker tag gs-rest-service registry.ng.bluemix.net/nheidloff/gs-rest-service docker push registry.ng.bluemix.net/nheidloff/gs-rest-service
to run the sample on bluemix create a docker container group.
after this you can run your rest api on bluemix.
Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.