action-docker-layer-caching icon indicating copy to clipboard operation
action-docker-layer-caching copied to clipboard

Rinning with the caching Slower then without a cache

Open avifatal opened this issue 3 years ago • 3 comments

Hi, The image bellow shows that this plugin makes the build really slower. When I run without the plugin, I get better results. Im sure the problem is on my side, what am I doing wrong? Thanks

image

This is the code:

jobs:
  build-push-gcr:
    name: Build and Push to GCP
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - uses: satackey/[email protected]

        continue-on-error: true
      - uses: google-github-actions/setup-gcloud@master
        with:
          service_account_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
          project_id: ${{ secrets.PROJECT_ID }}

      - name: Build Docker Image
        run: DOCKER_BUILDKIT=1 docker build -t ${{ inputs.APP_NAME }}/${{ inputs.BRANCH_NAME }} -f ./infra/build/${{ inputs.APP_NAME }}/Dockerfile .

      - name: Configure Docker Client
        run: |-
          gcloud auth configure-docker --quiet
          gcloud auth configure-docker us-central1-docker.pkg.dev --quiet

      - name: Push Docker Image to Container Registry (GCR)
        run: |-
          docker tag ${{ inputs.APP_NAME }}/${{ inputs.BRANCH_NAME }} gcr.io/${{ secrets.PROJECT_ID }}/${{ inputs.APP_NAME }}/${{ inputs.BRANCH_NAME }}
          docker push gcr.io/${{ secrets.PROJECT_ID }}/${{ inputs.APP_NAME }}/${{ inputs.BRANCH_NAME }}

avifatal avatar Mar 01 '22 16:03 avifatal

The problem is with the docker push command. I have the same issue, the caching also caches those images, and when loading it loads those as well, even though they are irrelevant.

Not sure how to fix this though...

raress96 avatar Mar 10 '22 10:03 raress96

Yes, I just put a step at the end after pushing those images to delete the tag image for the registry.

However do you guys know if there is a way to clear the images that are already in the cache?

ripmd-alex-deng avatar Mar 28 '22 16:03 ripmd-alex-deng

Yes, I just put a step at the end after pushing those images to delete the tag image for the registry.

However do you guys know if there is a way to clear the images that are already in the cache?

Can you share the snippet on how you clear the images? You can clear images from cache by changing the cache key and restore-keys.

raress96 avatar Mar 29 '22 06:03 raress96