This is the repo for a Spring Boot app in Docker Original Repo
The Spring boot app is deployed in Cloud Foundry as a Docker Container
-
Clone the Repo --
git clone https://github.com/rjain-pivotal/spring-boot-docker-cf.git
-
Build it and Run it locally -- If using Maven
mvn package && java -jar target/gs-spring-boot-docker-0.1.0.jar
If using Gradle
./gradlew build && java -jar build/libs/gs-spring-boot-docker-0.1.0.jar
-
Containerize it --
Set up the environment:
export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.101:2376" export DOCKER_CERT_PATH="/Users/mary/.docker/machine/machines/default" export DOCKER_MACHINE_NAME="default" # Run this command to configure your shell: # eval "$(docker-machine env default)"
If using Maven
$ mvn package docker:build # Push the Image to Docker $ docker push <docker-user>/gs-spring-boot-docker
If using Gradle
$ ./gradlew build buildDocker
-
Check and Run --
$docker images # Get the Docker Machine VM IP if running on a MAC $docker-machine env default (Get the Machine IP) $docker run -p 8080:8080 -t rjain15/gs-spring-boot-docker $curl http://192.168.99.100:8080 (Use the Machine IP)
-
Run it in Cloud Foundry --
$cf push -o <docker-user>/gs-spring-boot-docker -c "java -Djava.security.egd=file:/dev/./urandom -jar /app.jar"