Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does gha cache work without using the official action? #744

Closed
dudicoco opened this issue Aug 23, 2021 · 2 comments
Closed

does gha cache work without using the official action? #744

dudicoco opened this issue Aug 23, 2021 · 2 comments

Comments

@dudicoco
Copy link

dudicoco commented Aug 23, 2021

When I try to use the following within GH actions, the cache is not getting exported:

    - name: Docker Build
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: docker buildx build --load --cache-from=type=gha --cache-to=type=gha,mode=max .

However, when using the official action the cache does get exported:

    - name: Docker Build
      uses: docker/build-push-action@v2
      with:
        context: .
        load: true
        cache-from: type=gha
        cache-to: type=gha,mode=max

Is gha cache only supported via the official Docker GH action?

@crazy-max
Copy link
Member

crazy-max commented Aug 23, 2021

@dudicoco

Is gha cache only supported via the official Docker GH action?

You can use GHA cache backend without the official action, see https://github.com/moby/buildkit#github-actions-cache-experimental.

    - name: Expose GitHub Runtime
      uses: crazy-max/ghaction-github-runtime@v1
    - name: Docker Build
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: docker buildx build --load --cache-from=type=gha --cache-to=type=gha,mode=max .

@dudicoco
Copy link
Author

Thanks @crazy-max!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants