DEV Community

Discussion on: Deploy to Kubernetes using Github Actions (including Slack notification)

Collapse
 
thearvindnarayan profile image
Arvind Narayan • Edited

This should help

- name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@master
 - name: Docker cache layers
        uses: actions/cache@v2
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-single-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-single-buildx
  - name: Build 
        uses: docker/build-push-action@v2
        with: 
          context: .
          push: true
          tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,dest=/tmp/.buildx-cache-new
  - name: Move cache
        run: |
          rm -rf /tmp/.buildx-cache
          mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Enter fullscreen mode Exit fullscreen mode