Update docker-ci.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Chatwoot Docker Image to AWS ECR | |
on: | |
push: | |
branches: | |
- develop | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-and-push: | |
name: Build and Push Docker Image to AWS ECR | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-south-1 # Replace with your AWS region | |
- name: Log in to Amazon ECR | |
run: | | |
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 688351450096.dkr.ecr.ap-south-1.amazonaws.com | |
# Step 3: Set up Docker build environment | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Step 4: Build and Push Docker Image | |
- name: Build and Push Docker Image | |
run: | | |
# Define the ECR repository URL | |
REPO_URL=688351450096.dkr.ecr.ap-south-1.amazonaws.com | |
# Build and push the Docker image | |
docker build -t $REPO_URL:latest . | |
docker push $REPO_URL:latest | |
# Step 5: Confirm Success | |
- name: Confirm Deployment | |
run: echo "Docker image pushed successfully to ECR!" |