- Name : Vijay.B
- Batch : DO8WD-E
Note : Due to the application's lack of support for the latest Node.js version, I've chosen to utilize Node.js 14
- Using a Dockerfile, the application was built on a Node.js base image, and the artifacts were then copied to an Nginx image for web access.
- A Docker-compose file has been created to manage and run the built application.
- Bash script was created to automate the build and run processes using Dockerfile and Docker-compose files.
- Branch named 'dev' was created in Github repository using Git.
git branch dev
- The application code has been pushed to the 'dev' branch.
- A .gitignore file has been created to avoid pushing unnecessary files.
- A .dockerignore file has been created to avoid pushing unnecessary files while dockerizing.
- Repository named 'dev' and 'prod' was created in docker hub with public and private access, respectively.
- Docker Hub with image
-
Installation of jenkins.
Prerequisites:
- Jenkins requires Java to run.
sudo apt install openjdk-21-jdk
Install Jenkins:
- Execute the following commands in the terminal to install Jenkins.
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \ https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null sudo apt-get update sudo apt-get install jenkins
Start Jenkins:
- Execute the following command in the terminal to start Jenkins.
sudo systemctl start jenkins
Access Jenkins:
- Once Jenkins is started, open a web browser and navigate to http://localhost:8080 (replace localhost with the IP address or hostname of the server)
Note port 8080 should be allowed in security group for jenkins system. Login Page:
Create a Multibranch pipeline:
Auto Build Trigger:
Note MultiBranch Action Triggers Plugin is required.
Jenkins Pipeline
- Jenkins requires Java to run.
EC2 console
Security group
Adding an EC2 instance as a node in Jenkins.