I have ec2 instance for testing. I deployed using OpsWorks, and now I'm making new job on Jenkins to deploy automatically. what I want to do is
when someone push to branch
I made a job that using ecr and deploy ECS Fargate, but never done using ecr and deploy pre existed ec2 instance.I wonder this is possible to make it.
Pre-requisite
On your EC2
you first have to install docker
.
There are many ways you can do it.
Once Jenkin build & push docker image to ECR
you can further add the step in Jenkin build steps. Jenkin will do SSH inside EC2
and pull and run the docker image.
Once Jenkin build & push docker image to ECR you can further add the step in Jenkin build steps. Jenkin will trigger shell script
file on EC2
. That sh
file having all logic to pull the latest one and stop existing etc.
From Jenkins also you can do it via ansible script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.