Skip to content

Tafessek/java-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-project

test web-hook

Page 1 of 3 OverviewContainers are revolutionizing the way we package and deploy applications. Traditionally, we would install applications on bare metal hardware or virtual machines in our computing environment. We would have to carefully place applications on infrastructure to minimize conflicting requirements such as different versions of shared libraries. Containers let us partition applications and related dependencies on a shared computing platform.In this week’s assignment, you will build a Docker container using a Dockerfile and a CI/CD infrastructure pipeline.RequirementsYou need to have a personal AWS account and GitHub account for this assignment.The assignmentLet’s start shipping those containers!Build Image PipelineIt is a common practice to automate the building of Docker images using a CI/CD pipeline. Launch a Jenkins stack in the us-east-1 region using the following template:jenkins-cf.jsonCreate a new GitHub Classroom repository by clicking on this link:https://classroom.github.com/a/nxfbHqewCreate a new Jenkins pipeline job calleddocker-pipelineand configure it to use a Jenkinsfile located in your Classroom repository.Note, you do not need to setup a pipeline build trigger or GitHub webhook for this assignment.One of the first things the Jenkinsfile should do is tell Jenkins to clone the repository using thegitcommand. Let’s use thePipeline Syntaxlink at the bottom of the pipeline configuration page to generate the proper syntax for this command.Click on thePipeline Syntaxlink at the bottom of the pipeline configuration page and select thegit: Gitsample step.Typein your git repository URL (ending with.git).Click theGenerate Pipeline Scriptbutton.Copy-and-paste the generated code into your Jenkinsfile. Your Jenkinsfile will have three stages:Setup,BuildandTest. TheSetupstage will clone a copy of the assignment GitHub repository (using the git code snippet above). It will also copy a webpage file from an S3 bucket into the project workspace. TheBuildstage will use a Dockerfile to build a new Docker image. Finally, theTeststage will create a new Dockercontainer using the Docker image and test it to see if it is working properly.Let’s look at the requirements for each of these stages.The Setup stageCreate an HTML file calledclassweb.htmlwith the following contents:

My class webserver

Store this file in an S3 bucket in the us-east-1 region. TheSetupstage of the pipeline will copy theclassweb.htmlfile from the S3 bucket into a file calledindex.htmlin the workspace.The Build StageTheBuildstage will use a Dockerfile to create a new container image calledclasswebwith a tag of1.0. Here are the configuration requirements for the Docker image:The new image must be based off thenginximage.Set the maintainer of the image to your name and email address.The image should expose port 80.Copy theindex.htmlwhich was downloaded from S3 to the /usr/share/nginx/html directory in the container.The Test StageTheTeststage will validate that the Docker image was created properly. The pipeline should create a new container calledclassweb1using the image built in the previous stage. The container should have the following configuration settings:The container should run in a detached (daemon) mode.The container should map port 80 within the container to port 80 on the host server.The container should have an environment variable mapping the keyNGINX_PORTto the value80.After launching the container, the pipeline should test the container using the curl command. The container is running on the Jenkins slave node, so you should make an HTTP request to the private IP address of that node. curl -s Finally, once the test completes the pipeline should stop and delete the container.Console OutputOnce you have the pipeline working properly, copy the console output from the last successful build into a file calledconsole.txtand check it into the GitHub repository.Check your workHere is what the contents of your git repository should look like before final submission:┣Dockerfile┣Jenkinsfile┗console.txtTerminate application environmentThe last step in the assignment is to terminate your CloudFormation stack on AWS.Submitting your assignmentI will review your published workon GitHub after the homework due date.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%