This project implements a CI/CD pipeline using GitHub Actions, Docker, Terraform, and AWS services. The pipeline builds a Docker image, pushes it to Amazon ECR, and deploys it to an ECS service using Fargate.
my-cicd-project
├── .github
│ └── workflows
│ └── deploy.yml
├── terraform
│ ├── variables.tf
│ ├── outputs.tf
│ ├── ecr.tf
│ ├── ecs.tf
│ ├── vpc.tf
│ └── providers.tf
├── docker
│ └── Dockerfile
├── src
│ └── app
├── scripts
│ └── deploy.sh
└── README.md
-
Clone the repository:
git clone <repository-url> cd my-cicd-project
-
Configure AWS credentials: Ensure that your AWS credentials are configured in your environment. You can use the AWS CLI to configure them.
-
Deploy the infrastructure: Navigate to the
terraformdirectory and run:terraform init terraform apply
-
Build and push the Docker image: You can manually build and push the Docker image using the following commands:
cd docker docker build -t <image-name> . docker tag <image-name>:latest <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<repository-name>:latest docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<repository-name>:latest
-
Run the deployment script: Execute the deployment script to automate the process:
cd scripts ./deploy.sh
After deployment, your application will be running on AWS ECS. You can access it via the load balancer URL provided in the outputs of the Terraform configuration.
This project is licensed under the MIT License.