Skip to content

Commit

Permalink
Add Blzmod example to pull.md (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjmaestro authored Sep 1, 2024
1 parent ffaa615 commit ed91f78
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 2 deletions.
42 changes: 41 additions & 1 deletion docs/pull.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 41 additions & 1 deletion oci/pull.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,57 @@ oci_pull(
"linux/arm64",
],
)
# A multi-arch base image with variants, note that it won't work with just "linux/arm64"
oci_pull(
name = "distroless_base_nossl_debian12",
digest = "sha256:73c3d3f3030516665c916ebc9baa80f89c1a90e438dc02f1fed525ed246c0c2a",
image = "gcr.io/distroless/base-nossl-debian12",
platforms = [
"linux/amd64",
"linux/arm64/v8",
],
)
```
Typical usage in `MODULE.bazel`:
```starlark
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
# A multi-arch base image with variants, note that it won't work with just "linux/arm64"
oci.pull(
name = "distroless_base_nossl_debian12",
digest = "sha256:73c3d3f3030516665c916ebc9baa80f89c1a90e438dc02f1fed525ed246c0c2a",
image = "gcr.io/distroless/base-nossl-debian12",
platforms = [
"linux/amd64",
"linux/arm64/v8",
],
)
use_repo(
oci,
"distroless_base_nossl_debian12",
"distroless_base_nossl_debian12_linux_amd64",
"distroless_base_nossl_debian12_linux_arm64_v8",
)
```
Now you can refer to these as a base layer in `BUILD.bazel`.
The target is named the same as the external repo, so you can use a short label syntax:
```
```starlark
oci_image(
name = "app",
base = "@distroless_static",
...
)
oci_image(
name = "app_arm64_v8",
base = "@distroless_base_nossl_debian12_linux_arm64_v8",
...
)
```
## Configuration
Expand Down

0 comments on commit ed91f78

Please sign in to comment.