Prerequisite: Valid Gitlab Account Valid Dockerhub Account and login to local system with that credentials ...
Prerequisite:
Valid Gitlab Account
Valid Dockerhub Account and login to local system with that credentials
Step 1: Create a single EC2 instance
AMI : ubuntu 18.04
Instance Type: t2.medium
SG : All traffic to open
key: some valid key
Step 2: Install maven, docker ,gitlab runner
sudo apt update
sudo apt install maven -y
sudo apt install docker.io -y
The latest version of git
Step 3: Create a project Capstone CICD in Gilab.
Step 4: Create a sample maven quick start project using maven archtype.
Step 5: Local Git repo and link it to GitLab project.
Step 6: Create 2 branches dev1 and dev2 branch
Step 7: Create a release branch
Step 8: Code from dev1 or dev2 ---> release branch ---> main branch
Step 9: Push code to respective code branch means Local main branch code to the main branch of Gitlab and dev1 to dev1 and so on.
Step 10: To create a Dockerfile - multistage to define the steps to include and deploy your jar file. and push it to gitlab repo.
Step 11: Create Gitlab CI/CD Pipeline where you need to define following stages
In each stage create a log file and store the information that stage is completed or not.
build stage:- Create the jar file using mvn clean package command
builddockerimg stage: Build Dockerfile by adding jar file in the dockerimage.
ImageScan Stage: docker scan for docker images
ImagePush stage: docker image is to be pushed to docker hub
test stage: jar file get created---pass
Parallel test stage: container from docker image and if you find the container get created it means test is passed
Step 12: In k8s cluster run the NodePort service to expose an application on the browser
COMMENTS