load("@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_zig//zig:defs.bzl", "zig_binary") load("@tar.bzl//tar:mtree.bzl", "mtree_spec") load("@tar.bzl//tar:tar.bzl", "tar") zig_binary( name = "llm", srcs = glob(["**/*.zig"]), main = "main.zig", visibility = ["//visibility:public"], deps = ["//zml", "@linenoise"], ) zig_binary( name = "lfm2_tests", srcs = glob(["**/*.zig"]), main = "models/lfm2_tests.zig", visibility = ["//visibility:public"], deps = ["//zml"], ) zig_binary( name = "llama_tests", srcs = glob(["**/*.zig"]), main = "models/llama_tests.zig", visibility = ["//visibility:public"], deps = ["//zml"], ) build_test( name = "test", targets = [":llm"], ) mtree_spec( name = "mtree", srcs = [":llm"], tags = ["manual"] ) tar( name = "archive", srcs = [":llm"], args = [ "--options", ",".join([ "zstd:compression-level=9", "zstd:threads=16", ]), ], compress = "zstd", mtree = ":mtree", tags = ["manual"] ) oci_image( name = "image_", base = "@distroless_cc_debian12", entrypoint = ["./{}/llm".format(package_name())], target_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:x86_64", ], tars = [":archive"], tags = ["manual"] ) platform_transition_filegroup( name = "image", srcs = [":image_"], tags = ["manual"], target_platform = "//platforms:linux_amd64", ) oci_load( name = "load", image = ":image", repo_tags = ["zmlai/llm:latest"], tags = ["manual"], ) oci_push( name = "push", image = ":image", remote_tags = ["latest"], repository = "index.docker.io/zmlai/llm", tags = ["manual"], ) oci_image( name = "image_debug_", base = "@debian_12", entrypoint = ["./examples/llm/llm"], target_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:x86_64", ], tars = [":archive"], tags = ["manual"], ) platform_transition_filegroup( name = "image_debug", srcs = [":image_debug_"], tags = ["manual"], target_platform = "//platforms:linux_amd64", ) oci_load( name = "load_debug", image = ":image_debug", repo_tags = ["zmlai/llm:debug"], tags = ["manual"], )