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

Add example of building a Dockerfile with local tar file build context #702

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

Conversation

njlr
Copy link

@njlr njlr commented Sep 21, 2024

This PR adds an example of using a Dockerfile with a local tar as a build context.

This is not the ideal approach, which this is clearly signposted in the README!, but it shows an easy migration path from rules_docker. The existing example does not show how Bazel build artefacts can be passed to BuildX.

How it works:

  1. Create a tar file using rules_pkg
  2. Pipe the tar file into BuildX using sh_binary and run_binary
  3. Use the BuildX output as a base for an oci_image

This is a replacement for container_run_and_commit.

The example could easily be adapted to behave like container_run_and_extract by changing the --output flag to a tar.

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

Successfully merging this pull request may close these issues.

1 participant