Remove example workspace and related documentation files.

This commit is contained in:
Foke Singh 2025-06-20 13:23:06 +00:00
parent e789e26008
commit a540564744
11 changed files with 155 additions and 292 deletions

View File

@ -14,21 +14,14 @@ We also recommend to add a `weights.bzl` file to your project root directory, so
you don't "pollute" your build file with long URLs and SHAs: you don't "pollute" your build file with long URLs and SHAs:
```python ```python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def _weights_impl(mctx): def _weights_impl(mctx):
http_file( http_archive(
name = "com_github_zml_cdn_mnist", name = "mnist",
downloaded_file_path = "mnist.pt", sha256 = "075905e433ea0cce13c3fc08832448ab86225d089b5d412be67f59c29388fb19",
sha256 = "d8a25252e28915e147720c19223721f0f53e3317493727ca754a2dd672450ba9", url = "https://mirror.zml.ai/data/mnist.tar.zst",
url = "https://github.com/ggerganov/ggml/raw/18703ad600cc68dbdb04d57434c876989a841d12/examples/mnist/models/mnist/mnist_model.state_dict", build_file_content = """exports_files(glob(["**"]), visibility = ["//visibility:public"])""",
)
http_file(
name = "com_github_zml_cdn_mnist_data",
downloaded_file_path = "mnist.ylc",
sha256 = "0fa7898d509279e482958e8ce81c8e77db3f2f8254e26661ceb7762c4d494ce7",
url = "https://github.com/ggerganov/ggml/raw/18703ad600cc68dbdb04d57434c876989a841d12/examples/mnist/models/mnist/t10k-images.idx3-ubyte",
) )
return mctx.extension_metadata( return mctx.extension_metadata(
@ -54,12 +47,12 @@ the following way:
zig_cc_binary( zig_cc_binary(
name = "mnist", name = "mnist",
args = [ args = [
"$(location @com_github_zml_cdn_mnist//file)", "$(location @mnist//:mnist.pt)",
"$(location @com_github_zml_cdn_mnist_data//file)", "$(location @mnist//:t10k-images.idx3-ubyte)",
], ],
data = [ data = [
"@com_github_zml_cdn_mnist//file", "@mnist//:mnist.pt",
"@com_github_zml_cdn_mnist_data//file", "@mnist//:t10k-images.idx3-ubyte",
], ],
main = "mnist.zig", main = "mnist.zig",
deps = [ deps = [
@ -74,4 +67,3 @@ See how:
- we use `data = [ ... ]` to reference the files in `weights.bzl` - we use `data = [ ... ]` to reference the files in `weights.bzl`
- we use `args = [ ... ]` to pass the files as command-line arguments to the - we use `args = [ ... ]` to pass the files as command-line arguments to the
MNIST executable at runtime, automatically. MNIST executable at runtime, automatically.

View File

@ -24,8 +24,7 @@ So, to run the Llama model from above **on your development machine**
housing an NVIDIA GPU, run the following: housing an NVIDIA GPU, run the following:
``` ```
cd examples bazel run --config=release //examples/llama --@zml//runtimes:cuda=true -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct
bazel run --config=release //llama --@zml//runtimes:cuda=true -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct
``` ```
@ -41,8 +40,7 @@ architectures:
As an example, here is how you build above Llama for CUDA on Linux X86_64: As an example, here is how you build above Llama for CUDA on Linux X86_64:
``` ```
cd examples bazel build --config=release //examples/llama \
bazel build --config=release //llama \
--@zml//runtimes:cuda=true \ --@zml//runtimes:cuda=true \
--@zml//runtimes:cpu=false \ --@zml//runtimes:cpu=false \
--platforms=@zml//platforms:linux_amd64 --platforms=@zml//platforms:linux_amd64
@ -83,7 +81,6 @@ tar(
... and then build the TAR archive: ... and then build the TAR archive:
``` ```
# cd examples
bazel build --config=release //mnist:archive \ bazel build --config=release //mnist:archive \
--@zml//runtimes:cuda=true \ --@zml//runtimes:cuda=true \
--@zml//runtimes:cpu=false \ --@zml//runtimes:cpu=false \
@ -134,4 +131,3 @@ INFO: Running command line: bazel-bin/mnist/mnist ../_main~_repo_rules~com_githu
You see the command line right up there. On the server, you just need to replace You see the command line right up there. On the server, you just need to replace
`../` with the 'runfiles' directory of your TAR. `../` with the 'runfiles' directory of your TAR.

View File

@ -133,8 +133,7 @@ platform_transition_filegroup(
And that's almost it! You can already build the image: And that's almost it! You can already build the image:
``` ```
# cd examples bazel build --config=release //examples/simple_layer:image
bazel build --config=release //simple_layer:image
INFO: Analyzed target //simple_layer:image (1 packages loaded, 8 targets configured). INFO: Analyzed target //simple_layer:image (1 packages loaded, 8 targets configured).
INFO: Found 1 target... INFO: Found 1 target...
@ -375,4 +374,3 @@ MNIST model, including weights and dataset, to the docker registry:
``` ```
bazel run //mnist:push --@zml//runtimes:cuda=true -- --repository index.docker.io/my_org/zml_mnist bazel run //mnist:push --@zml//runtimes:cuda=true -- --repository index.docker.io/my_org/zml_mnist
``` ```

View File

@ -30,8 +30,6 @@ Now you're ready to download a gated model like `Meta-Llama-3.2-1b`!
``` ```
# requires token in $HOME/.cache/huggingface/token, as created by the # requires token in $HOME/.cache/huggingface/token, as created by the
# `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable. # `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable.
cd examples
bazel run @zml//tools:hf -- download meta-llama/Llama-3.2-1B-Instruct --local-dir $HOME/Llama-3.2-1B-Instruct --exclude='*.pth' bazel run @zml//tools:hf -- download meta-llama/Llama-3.2-1B-Instruct --local-dir $HOME/Llama-3.2-1B-Instruct --exclude='*.pth'
bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct --prompt="What is the capital of France?" bazel run --config=release //examples/llama -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct --prompt="What is the capital of France?"
``` ```

View File

@ -49,7 +49,6 @@ compile it, and classify a randomly picked example from the test dataset.
On the command line: On the command line:
``` ```
cd examples
bazel run --config=release //mnist bazel run --config=release //mnist
``` ```
@ -74,9 +73,8 @@ Once you've been granted access, you're ready to download a gated model like
``` ```
# requires token in $HOME/.cache/huggingface/token, as created by the # requires token in $HOME/.cache/huggingface/token, as created by the
# `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable. # `huggingface-cli login` command, or the `HUGGINGFACE_TOKEN` environment variable.
cd examples
bazel run @zml//tools:hf -- download meta-llama/Llama-3.1-8B-Instruct --local-dir $HOME/Llama-3.1-8B-Instruct --exclude='*.pth' bazel run @zml//tools:hf -- download meta-llama/Llama-3.1-8B-Instruct --local-dir $HOME/Llama-3.1-8B-Instruct --exclude='*.pth'
bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.1-8B-Instruct bazel run --config=release //examples/llama -- --hf-model-path=$HOME/Llama-3.1-8B-Instruct
bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.1-8B-Instruct --prompt="What is the capital of France?" bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.1-8B-Instruct --prompt="What is the capital of France?"
``` ```
@ -88,9 +86,8 @@ Like the 8B model above, this model also requires approval. See
[here](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) for access requirements. [here](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) for access requirements.
``` ```
cd examples
bazel run @zml//tools:hf -- download meta-llama/Llama-3.2-1B-Instruct --local-dir $HOME/Llama-3.2-1B-Instruct --exclude='*.pth' bazel run @zml//tools:hf -- download meta-llama/Llama-3.2-1B-Instruct --local-dir $HOME/Llama-3.2-1B-Instruct --exclude='*.pth'
bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct bazel run --config=release //examples/llama -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct
bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct --prompt="What is the capital of France?" bazel run --config=release //llama -- --hf-model-path=$HOME/Llama-3.2-1B-Instruct --prompt="What is the capital of France?"
``` ```
@ -121,9 +118,8 @@ So, to run the OpenLLama model from above on your host sporting an NVIDIA GPU,
run the following: run the following:
``` ```
cd examples bazel run --config=release //examples/llama:Llama-3.2-1B-Instruct \
bazel run --config=release //llama:Llama-3.2-1B-Instruct \ --@zml//runtimes:cuda=true \
--@zml//runtimes:cuda=true \
-- --prompt="What is the capital of France?" -- --prompt="What is the capital of France?"
``` ```
@ -140,4 +136,3 @@ You might also want to check out the
[documentation](../README.md), start [documentation](../README.md), start
[writing your first model](../tutorials/write_first_model.md), or read about more [writing your first model](../tutorials/write_first_model.md), or read about more
high-level [ZML concepts](../learn/concepts.md). high-level [ZML concepts](../learn/concepts.md).

View File

@ -381,8 +381,7 @@ With everything in place now, running the model is easy:
``` ```
# run release (--config=release) # run release (--config=release)
cd examples bazel run --config=release //examples/simple_layer
bazel run --config=release //simple_layer
# compile and run debug version # compile and run debug version
bazel run //simple_layer bazel run //simple_layer

View File

@ -1,11 +1,17 @@
load("@zml//bazel:zig.bzl", "zig_cc_binary") load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("//bazel:zig.bzl", "zig_cc_binary")
zig_cc_binary( zig_cc_binary(
name = "benchmark", name = "benchmark",
main = "main.zig", main = "main.zig",
deps = [ deps = [
"@zml//async", "//async",
"@zml//stdx", "//stdx",
"@zml//zml", "//zml",
], ],
) )
build_test(
name = "test",
targets = [":benchmark"],
)

View File

@ -1,11 +1,8 @@
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar") load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@bazel_skylib//rules:native_binary.bzl", "native_test") load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push") load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
load("@zml//bazel:zig.bzl", "zig_cc_binary") load("//bazel:zig.bzl", "zig_cc_binary")
zig_cc_binary( zig_cc_binary(
name = "llama", name = "llama",
@ -14,65 +11,58 @@ zig_cc_binary(
], ],
main = "main.zig", main = "main.zig",
deps = [ deps = [
"//async",
"//stdx",
"//zml",
"@com_github_hejsil_clap//:clap", "@com_github_hejsil_clap//:clap",
"@zml//async",
"@zml//stdx",
"@zml//zml",
], ],
) )
zig_cc_binary( # TODO(steeve): Re-enable when rules_zig linkmode is fixed.
name = "test-implementation", #
srcs = ["llama.zig"], # zig_cc_binary(
args = [ # name = "test-implementation",
"--weights=$(location @Meta-Llama-3.1-8B-Instruct//:model.safetensors.index.json)", # srcs = ["llama.zig"],
"--config=$(location @Meta-Llama-3.1-8B-Instruct//:config.json)", # args = [
], # "--weights=$(location @Meta-Llama-3.1-8B-Instruct//:model.safetensors.index.json)",
data = [ # "--config=$(location @Meta-Llama-3.1-8B-Instruct//:config.json)",
"@Meta-Llama-3.1-8B-Instruct//:config.json", # ],
"@Meta-Llama-3.1-8B-Instruct//:model.safetensors.index.json", # data = [
], # "@Meta-Llama-3.1-8B-Instruct//:config.json",
main = "test.zig", # "@Meta-Llama-3.1-8B-Instruct//:model.safetensors.index.json",
tags = [ # ],
"manual", # main = "test.zig",
], # deps = [
deps = [ # "//async",
"@zml//async", # "//stdx",
"@zml//stdx", # "//zml",
"@zml//zml", # ],
], # )
)
native_test( # native_test(
name = "test_tokenizer", # name = "test_tokenizer",
src = "@zml//zml/tokenizer:main", # src = "//zml/tokenizer:main",
# Note: all Llama-3.x tokenizers are the same, # # Note: all Llama-3.x tokenizers are the same,
# but using the 3.2-1B version because downloading the tokenizer triggers downloading the model. # # but using the 3.2-1B version because downloading the tokenizer triggers downloading the model.
args = [ # args = [
"--tokenizer=$(location @Meta-Llama-3.2-1B-Instruct//:tokenizer.json)", # "--tokenizer=$(location @Meta-Llama-3.2-1B-Instruct//:tokenizer.json)",
"""--prompt='Examples of titles: # """--prompt='Examples of titles:
📉 Stock Market Trends # 📉 Stock Market Trends
🍪 Perfect Chocolate Chip Recipe # 🍪 Perfect Chocolate Chip Recipe
Evolution of Music Streaming # Evolution of Music Streaming
Remote Work Productivity Tips # Remote Work Productivity Tips
Artificial Intelligence in Healthcare # Artificial Intelligence in Healthcare
🎮 Video Game Development Insights # 🎮 Video Game Development Insights
'""", # '""",
# this correspond to encoding with HF tokenizers, with bos=False # # this correspond to encoding with HF tokenizers, with bos=False
"--expected=41481,315,15671,512,9468,241,231,12937,8152,50730,198,9468,235,103,24118,39520,32013,26371,198,35212,3294,315,10948,45910,198,25732,5664,5761,1968,26788,198,9470,16895,22107,304,39435,198,9468,236,106,8519,4140,11050,73137,198", # "--expected=41481,315,15671,512,9468,241,231,12937,8152,50730,198,9468,235,103,24118,39520,32013,26371,198,35212,3294,315,10948,45910,198,25732,5664,5761,1968,26788,198,9470,16895,22107,304,39435,198,9468,236,106,8519,4140,11050,73137,198",
], # ],
data = ["@Meta-Llama-3.2-1B-Instruct//:tokenizer.json"], # data = ["@Meta-Llama-3.2-1B-Instruct//:tokenizer.json"],
tags = [ # )
"manual",
],
)
mtree_spec( mtree_spec(
name = "mtree", name = "mtree",
srcs = [":llama"], srcs = [":llama"],
tags = [
"manual",
],
) )
tar( tar(
@ -80,54 +70,48 @@ tar(
srcs = [":llama"], srcs = [":llama"],
args = [ args = [
"--options", "--options",
"zstd:compression-level=9", ",".join([
"zstd:compression-level=9",
"zstd:threads=16",
]),
], ],
compress = "zstd", compress = "zstd",
mtree = ":mtree", mtree = ":mtree",
tags = [
"manual",
],
) )
oci_image( oci_image(
name = "image_", name = "image_",
base = "@distroless_cc_debian12_debug", base = "@distroless_cc_debian12",
entrypoint = ["./{}/llama".format(package_name())], entrypoint = ["/{}/llama".format(package_name())],
tags = [ target_compatible_with = [
"manual", "@platforms//os:linux",
],
tars = [
"@zml//runtimes:layers",
":archive",
], ],
tars = [":archive"],
) )
platform_transition_filegroup( platform_transition_filegroup(
name = "image", name = "image",
srcs = [":image_"], srcs = [":image_"],
tags = [ tags = ["manual"],
"manual", target_platform = "//platforms:linux_amd64",
],
target_platform = "@zml//platforms:linux_amd64",
) )
oci_load( oci_load(
name = "load", name = "load",
image = ":image", image = ":image",
repo_tags = [ repo_tags = ["zmlai/llama:latest"],
"distroless/llama:latest", tags = ["manual"],
],
tags = [
"manual",
],
) )
oci_push( oci_push(
name = "push", name = "push",
image = ":image", image = ":image",
remote_tags = ["latest"], remote_tags = ["latest"],
repository = "index.docker.io/steeve/llama", repository = "index.docker.io/zmlai/llama",
tags = [ tags = ["manual"],
"manual", )
],
build_test(
name = "test",
targets = [":llama"],
) )

View File

@ -1,108 +1,24 @@
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template") load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar") load("//bazel:zig.bzl", "zig_cc_binary")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
load("@zml//bazel:zig.bzl", "zig_cc_binary")
# Executable
zig_cc_binary( zig_cc_binary(
name = "mnist", name = "mnist",
args = [ args = [
"$(location @com_github_ggerganov_ggml_mnist//file)", "$(location @mnist//:mnist.pt)",
"$(location @com_github_ggerganov_ggml_mnist_data//file)", "$(location @mnist//:t10k-images.idx3-ubyte)",
], ],
data = [ data = [
"@com_github_ggerganov_ggml_mnist//file", "@mnist//:mnist.pt",
"@com_github_ggerganov_ggml_mnist_data//file", "@mnist//:t10k-images.idx3-ubyte",
], ],
main = "mnist.zig", main = "mnist.zig",
deps = [ deps = [
"@zml//async", "//async",
"@zml//zml", "//zml",
], ],
) )
mtree_spec( build_test(
name = "mtree", name = "test",
srcs = [":mnist"], targets = [":mnist"],
)
tar(
name = "archive",
srcs = [":mnist"],
args = [
"--options",
"zstd:compression-level=9",
],
compress = "zstd",
mtree = ":mtree",
)
expand_template(
name = "entrypoint",
data = [
":mnist",
"@com_github_ggerganov_ggml_mnist//file",
"@com_github_ggerganov_ggml_mnist_data//file",
],
substitutions = {
":model": "$(rlocationpath @com_github_ggerganov_ggml_mnist//file)",
":data": "$(rlocationpath @com_github_ggerganov_ggml_mnist_data//file)",
},
template = [
"./{}/mnist".format(package_name()),
"./{}/mnist.runfiles/:model".format(package_name()),
"./{}/mnist.runfiles/:data".format(package_name()),
],
)
oci_image(
name = "image_",
base = "@distroless_cc_debian12",
entrypoint = ":entrypoint",
target_compatible_with = [
"@platforms//os:linux",
],
tars = [":archive"],
)
platform_transition_filegroup(
name = "image",
srcs = [":image_"],
target_compatible_with = [
"@platforms//os:linux",
],
target_platform = "@zml//platforms:linux_amd64",
)
oci_load(
name = "load",
image = ":image",
repo_tags = [
"distroless/mnist:latest",
],
target_compatible_with = [
"@platforms//os:linux",
],
)
oci_push(
name = "push",
image = ":image",
remote_tags = ["latest"],
repository = "index.docker.io/steeve/mnist",
target_compatible_with = [
"@platforms//os:linux",
],
)
oci_load(
name = "debug_image",
image = ":image",
repo_tags = [
"distroless/mnist:latest",
],
target_compatible_with = [
"@platforms//os:linux",
],
) )

View File

@ -1,70 +1,46 @@
load("@rules_cc//cc:cc_binary.bzl", "cc_binary") load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@zml//bazel:zig.bzl", "zig_cc_binary") load("//bazel:zig.bzl", "zig_cc_binary")
zig_cc_binary( zig_cc_binary(
name = "modernbert", name = "modernbert",
srcs = ["modernbert.zig"], srcs = ["modernbert.zig"],
main = "main.zig",
deps = [
"@com_github_hejsil_clap//:clap",
"@zml//async",
"@zml//stdx",
"@zml//zml",
],
)
cc_binary(
name = "ModernBERT-base",
args = [ args = [
"--model=$(location @ModernBERT-base//:model.safetensors)", "--model=$(location @ModernBERT-base//:model.safetensors)",
"--tokenizer=$(location @ModernBERT-base//:tokenizer)", "--tokenizer=$(location @ModernBERT-base//:tokenizer.json)",
"--num-attention-heads=12", "--num-attention-heads=12",
"--tie-word-embeddings=true", "--tie-word-embeddings=true",
], ],
data = [ data = [
"@ModernBERT-base//:model.safetensors", "@ModernBERT-base//:model.safetensors",
"@ModernBERT-base//:tokenizer", "@ModernBERT-base//:tokenizer.json",
],
tags = [
"manual",
],
deps = [":modernbert_lib"],
)
cc_binary(
name = "ModernBERT-large",
args = [
"--model=$(location @ModernBERT-large//:model.safetensors)",
"--tokenizer=$(location @ModernBERT-large//:tokenizer)",
"--num-attention-heads=16",
"--tie-word-embeddings=true",
],
data = [
"@ModernBERT-large//:model.safetensors",
"@ModernBERT-large//:tokenizer",
],
tags = [
"manual",
],
deps = [":modernbert_lib"],
)
zig_cc_binary(
name = "test-implementation",
srcs = ["modernbert.zig"],
args = [
"--model=$(location @ModernBERT-base//:model.safetensors)",
],
data = [
"@ModernBERT-base//:model.safetensors",
],
main = "test.zig",
tags = [
"manual",
], ],
main = "main.zig",
deps = [ deps = [
"//async",
"//stdx",
"//zml",
"@com_github_hejsil_clap//:clap", "@com_github_hejsil_clap//:clap",
"@zml//async",
"@zml//zml",
], ],
) )
# zig_cc_binary(
# name = "test-implementation",
# srcs = ["modernbert.zig"],
# args = [
# "--model=$(location @ModernBERT-base//:model.safetensors)",
# ],
# data = [
# "@ModernBERT-base//:model.safetensors",
# ],
# main = "test.zig",
# deps = [
# "//async",
# "//zml",
# "@com_github_hejsil_clap//:clap",
# ],
# )
build_test(
name = "test",
targets = [":modernbert"],
)

View File

@ -1,14 +1,15 @@
load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar") load("@aspect_bazel_lib//lib:tar.bzl", "mtree_spec", "tar")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push") load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load", "oci_push")
load("@zml//bazel:zig.bzl", "zig_cc_binary") load("//bazel:zig.bzl", "zig_cc_binary")
zig_cc_binary( zig_cc_binary(
name = "simple_layer", name = "simple_layer",
main = "main.zig", main = "main.zig",
deps = [ deps = [
"@zml//async", "//async",
"@zml//zml", "//zml",
], ],
) )
@ -24,7 +25,10 @@ tar(
srcs = [":simple_layer"], srcs = [":simple_layer"],
args = [ args = [
"--options", "--options",
"zstd:compression-level=9", ",".join([
"zstd:compression-level=9",
"zstd:threads=16",
]),
], ],
compress = "zstd", compress = "zstd",
mtree = ":mtree", mtree = ":mtree",
@ -34,7 +38,7 @@ tar(
oci_image( oci_image(
name = "image_", name = "image_",
base = "@distroless_cc_debian12", base = "@distroless_cc_debian12",
entrypoint = ["./{}/simple_layer".format(package_name())], entrypoint = ["/{}/simple_layer".format(package_name())],
target_compatible_with = [ target_compatible_with = [
"@platforms//os:linux", "@platforms//os:linux",
], ],
@ -45,10 +49,8 @@ oci_image(
platform_transition_filegroup( platform_transition_filegroup(
name = "image", name = "image",
srcs = [":image_"], srcs = [":image_"],
target_compatible_with = [ tags = ["manual"],
"@platforms//os:linux", target_platform = "//platforms:linux_amd64",
],
target_platform = "@zml//platforms:linux_amd64",
) )
# Load will immediatly load the image (eg: docker load) # Load will immediatly load the image (eg: docker load)
@ -58,9 +60,7 @@ oci_load(
repo_tags = [ repo_tags = [
"distroless/simple_layer:latest", "distroless/simple_layer:latest",
], ],
target_compatible_with = [ tags = ["manual"],
"@platforms//os:linux",
],
) )
# Bazel target for pushing the Linux image to the docker registry # Bazel target for pushing the Linux image to the docker registry
@ -69,8 +69,11 @@ oci_push(
image = ":image", image = ":image",
remote_tags = ["latest"], remote_tags = ["latest"],
# override with -- --repository foo.bar/org/image # override with -- --repository foo.bar/org/image
repository = "index.docker.io/renerocksai/simple_layer", repository = "index.docker.io/zmlai/simple_layer",
target_compatible_with = [ tags = ["manual"],
"@platforms//os:linux", )
],
build_test(
name = "test",
targets = [":simple_layer"],
) )