Pipeline built in Jenkins for the Spring project: https://github.com/spring-projects/spring-petclinic
.
- 'spring-petclinic-hub' repository is where all the runnable images are stored: https://hub.docker.com/repository/docker/tyitzhak/spring-petclinic-hub.
- 'jenkins-docker' repository is where all the containers with jenkins and docker installed are stored: https://hub.docker.com/repository/docker/tyitzhak/jenkins-docker.
- Install wget using brew:
brew install wget
. - Docker installed.
-
Clone the project:
git clone https://github.com/talitz/spring-petclinic-jenkins-pipeline.git
-
CD into the project and provide permissions to the shell running scripts:
cd spring-petclinic-jenkins-pipeline
chmod 755 *.sh
-
Run a containerized Docker & Jenkins environemnt using (please provide your password when prompted):
./start.sh
Note: this takes time, due to the download folder of 'jenkins_home'; it contains all the necessary configurations (job, plugins, etc) for the project to be initialized without manually installing Jenkins. -
Browse into
localhost:8080
and insert the following username & password:
- username: 'admin'.
- password: run the following command in a new terminal and insert the output as a password:
docker exec jenkins-docker cat /var/jenkins_home/secrets/initialAdminPassword
- Please verify the password for the tyitzhak user in docker hub is the same in Jenkins Credentials Manager - unless you'll get bad credentials error in deploying to dockerhub.
- Go into the 'spring-petclinic-hub' job, and click on 'Build now'.
Open BlueOcean and follow the pipeline. When it is done (it takes more then 15 minutes, the 'Compile' step takes time) it should look like that:
Note: If one of the stages fails, due to connection/unrelated issues, re-run the stage in Jenkins (shouldn't happen, but just in case).
The runnable docker image is stored at tyitzhak/spring-petclinic-hub:latest.
Pull the latest petclinic-container image from the dockerhub repository:
docker pull tyitzhak/spring-petclinic-hub:latest
Run the container using:
docker run -d --name petclinic-container -p 8181:8181 tyitzhak/spring-petclinic-hub:latest
Go into localhost:8181
(it takes about ~10 seconds until the application is up).
Your application is now READY! :)
You can run the container's shell using:
docker exec -it petclinic-container sh
Run ./terminate.sh
.