diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index cedbd57..829d695 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -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