Skip to content

Commit

Permalink
Modified .env and ci-cd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
forkimenjeckayang committed Sep 5, 2024
1 parent f7bb1d9 commit 0aeef4a
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,32 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
- 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: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Upload image to ECR
uses: appleboy/docker-ecr-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
repo: ${{ env.IMAGE_NAME }}
registry: ${{ env.REGISTRY }}
region: ${{ secrets.AWS_REGION }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

0 comments on commit 0aeef4a

Please sign in to comment.