Pre-Requisites:
- Docker
- Terraform
- You're ready to go!
Steps:
- Run
docker build -t customjenkins:latest .
- Run
docker run -d --restart-always -p 50000:50000 -p 8080:8080 --name jenkins customjenkins:latest
- Open localhost:8080 in your browser and paste the output of
docker exec -it jenkins cat /var/lib/jenkins/home/secrets/initialAdminPassword
in the initial jenkins setup. - Install the default plugins and once done go to manage plugins and add the "AWS Global Configuration" plugin and install it.
- Make a new global credential with the type AWS and paste in your AWS Account Access Key and Secret.
- Make a new Jenkins Pipeline and use the Jenkinsfile.jenkinsfile provided in the repo as pipeline code.
- Run terraform init on your machine and then terraform apply.
- Run the pipeline, which will checkout a simple hello-world maven project and deploy the image on AWS ECS (Fargate)
- Go to your AWS Console and update the ECS service and access your Maven WebApp from the task's public IP.