Skip to content

Commit

Permalink
docs: github-cache-bake context usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rcwbr authored Dec 15, 2024
1 parent 9c8a67b commit d76e27f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ docker builder create --use --bootstrap --driver docker-container
The bake file requires at least `IMAGE_NAME` variable to be set, and `REGISTRY` should nearly always be overridden (see [GitHub cache bake file inputs](#github-cache-bake-file-inputs)). Export them:

```bash
REGISTRY=ghcr.io/[your account]/
IMAGE_NAME=[your repo/image name]
REGISTRY=ghcr.io/[your account]
IMAGE_NAME=[image name]
```

By default, the `github-cache-bake.hcl` file expects a Dockerfile in the bake command execution directory (via `cwd://Dockerfile`), which is used for the build. It sets the default [`context`](https://docs.docker.com/build/bake/reference/#targetcontext) to `BAKE_CMD_CONTEXT` such that the filesystem local to the bake execution are available to the image build.

To build your image using the GitHub cache bake file via [remote bake definition](https://docs.docker.com/build/bake/remote-definition/), run this command:

```bash
'docker buildx bake --file github-cache-bake.hcl https://github.com/rcwbr/dockerfile-partials.git#0.1.0'
REGISTRY=ghcr.io/[your account] IMAGE_NAME=[image name] docker buildx bake --file github-cache-bake.hcl https://github.com/rcwbr/dockerfile-partials.git#0.1.0
```

### GitHub cache bake file inputs
Expand Down

0 comments on commit d76e27f

Please sign in to comment.