DevOps java project
-> first install all the dependencies
-jdk,jvm,docker,Jenkins,eclipse
->create a folder which will have the code
->open that folder in the vs code
->then create a new java file in that and write a piece of code.
->now in the same folder create a Dockerfile .
->in that docker file write the command to run the java file.
->
->save it , And push all the file in to github
-> pushing files to git hub.
->first create a repository in the git hub and after creating the repository copy the
git remote
->open the terminal ,navigate to the folder and write the commands to push files.
git init
git remote add origin https://github.com/raj-kumar-1/<repository-name>
git add .
git commit -m “initial commit”
git push -u origin master
->after successfully pushing all the files into github ,verify in the github whether all the files have
been added or not
->now open Jenkins in localhost:8080
->click on the new item
->enter the item name and select the freestyle project and click on ok.
->
->after clicking ok,a configure page will be opened
->click on the source code management
->select git and give all the required details like your repository(which we have created earlier) link
and branch .
->if you have the file not in the master branch then add new branch
->*/<your_branch>
->now click on the build steps
->click on the add build step and select Execute Windows batch command
->and write the docker commands to create the docker image.
->
->later while running the image in the docker desktop if a error regarding the port,try changing the
port numbers here like 8084:3000
->click apply and save.
->after clicking
->make sure that you have started the docker .
->click on build now
->after a successful build you will see the tick mark
->now open the docker
->
->search the container that is newly created.
->run the container
->after the successful run.
->you will be seeing the output printing hello world.