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

using gha cache with docker-container #20748

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sozercan
Copy link
Contributor

Description

documents how to use gha cache with docker-container driver

Related issues or tickets

Reviews

  • Technical review
  • Editorial review
  • Product review

@github-actions github-actions bot added the area/build Relates to Dockerfiles or docker build command label Aug 30, 2024
Copy link

netlify bot commented Aug 30, 2024

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit d110452
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/66d2395afcc49f0008653f5a
😎 Deploy Preview https://deploy-preview-20748--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -57,6 +57,14 @@ exposed. Consider using the
[`crazy-max/ghaction-github-runtime`](https://github.com/crazy-max/ghaction-github-runtime),
GitHub Action as a helper for exposing the variables.

If you are using the `docker-container` driver, `ACTIONS_RUNTIME_TOKEN` and `ACTIONS_RUNTIME_URL` environment variables must be passed into the container.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, Buildx already sets token and url attributes for gha exporter during build: https://github.com/docker/buildx/blob/96eb69aea4e03baf516f29ec36aa93a9c284f085/util/buildflags/cache.go#L69-L84

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool. I wonder why we were having an issue getting this to work. Maybe an older buildx not using the controller api?

Copy link
Member

@crazy-max crazy-max Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you run docker buildx in a run step? If that's the case then ACTIONS_RUNTIME_TOKEN and ACTIONS_RUNTIME_URL envs are not exposed: https://docs.docker.com/build/cache/backends/gha/#authentication

You would need smth like https://github.com/crazy-max/ghaction-github-runtime?tab=readme-ov-file#usage

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we're definitely using that. Will have to take a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Relates to Dockerfiles or docker build command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants