Skip to content

Commit

Permalink
change1
Browse files Browse the repository at this point in the history
  • Loading branch information
SiddhantH1512 committed Feb 26, 2024
1 parent 9004431 commit a1d2c5b
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,38 @@ jobs:
build-and-push-ecr:
name: Build and Push to ECR
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
- name: Build, tag, and push image to Amazon ECR
run: |
# Define the image name and tag
IMAGE_NAME=realestate-pricing-app
IMAGE_TAG=latest # or use $(git rev-parse --short HEAD) for commit hash
# Full image name including registry and repo
FULL_IMAGE_NAME=$IMAGE_NAME:$IMAGE_TAG
ECR_FULL_IMAGE_NAME=${{ secrets.AWS_ECR_LOGIN_URI }}/$IMAGE_NAME:$IMAGE_TAG
# Build the Docker image
docker build -t $FULL_IMAGE_NAME .
# Login to Amazon ECR
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ECR_LOGIN_URI }}
- name: Build, tag, and push image to Amazon ECR
run: |
docker build -t ${{ secrets.AWS_ECR_LOGIN_URI }}/${{ secrets.AWS_ECR_REPOSITORY_NAME }}:latest .
docker push ${{ secrets.AWS_ECR_LOGIN_URI }}/${{ secrets.AWS_ECR_REPOSITORY_NAME }}:latest
# Tag the image to match the ECR repository
docker tag $FULL_IMAGE_NAME $ECR_FULL_IMAGE_NAME
# Push the image to ECR
docker push $ECR_FULL_IMAGE_NAME
deploy-to-ec2:
name: Deploy to EC2
Expand Down

0 comments on commit a1d2c5b

Please sign in to comment.