Skip to content

bob-crutchley/spring-boot-hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-hello-world

This is a very simple Spring Boot Application which works well for testing CI solutions. The application can be deployed into a Docker image which can then be run just as a container or apart of a Kubernetes cluster. For an example of how this project can be implemented into a simple pipeline, see the spring-boot-hello-world-ci project.

  • It will be useful to first have Docker Hub Account so that your images can be accessible on the internet
  • You will need to install Docker

Installing Docker (if you need to)

On Linux you can run these commands, log out and back in.

curl https://get.docker.com | sudo bash
sudo usermod -aG docker $(whoami)
exit

Docker Hub Website and follow the install steps, Docker Compose will be installed this way as well - (Windows) (Mac)

Building the Docker Image

We can build the Docker image using this command replacing bobcrutchley with whatever your Docker Hub username is:

docker build -t bobcrutchley/spring-boot-hello-world:latest

Pushing Your Image to Docker Hub

Pushing your new Image to Docker Hub will make it accessible from anywhere:

docker login
docker push bobcrutchley/spring-boot-hello-world:latest

Running with Docker

The image can also be run locally:

docker run -d -p 8080:8080 --name spring-boot-hello-world --rm bobcrutchley/spring-boot-hello-world:latest

Running with Kubernetes (Google Cloud Platform)

You will need to have the following to be able to these commands:

  • A free trial or subscription to Google Cloud Platform

  • Have the GCloud SDK installed

  • Have the Kubernetes Engine API enabled (Requires GCloud SDK to be installed)

     gcloud services enable containers.googleapis.com
  • Make sure that you are logged in to the GCloud SDK

    gcloud auth login
  • Install the kubectl component, this will allow us to communicate with the Kubernetes cluster

    gcloud components install kubectl
  • Create a new cluster

    gcloud container clusters create spring-boot-hello-world
  • The Deployment and Service for the application can be made by running this command from the project root:

    kubectl create -f kubernetes 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published