-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathBUILD.bazel
More file actions
82 lines (73 loc) · 1.77 KB
/
Copy pathBUILD.bazel
File metadata and controls
82 lines (73 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
load("@aspect_rules_py//py:defs.bzl", "py_binary", "py_image_layer", "py_library")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@pip//:requirements.bzl", "requirement")
load("@rules_img//img:image.bzl", "image_index", "image_manifest")
load("@rules_img//img:load.bzl", "image_load")
load("@rules_img//img:push.bzl", "image_push")
py_library(
name = "hello_world_lib",
srcs = [
"__init__.py",
"app.py",
],
visibility = ["//oci_python_image:__subpackages__"],
deps = [requirement("cowsay")],
)
py_binary(
name = "hello_world_app",
srcs = ["__main__.py"],
main = "__main__.py",
visibility = [
"//image_from_binary_example:__subpackages__",
"//oci_python_image:__subpackages__",
],
deps = [":hello_world_lib"],
)
py_image_layer(
name = "layers",
binary = ":hello_world_app",
)
image_manifest(
name = "image",
base = "@ubuntu",
entrypoint = ["/hello_world_app"],
layers = [":layers"],
)
image_index(
name = "multiarch_image",
manifests = [":image"],
platforms = [
"//platform:linux_arm64",
"//platform:linux_amd64",
],
)
image_load(
name = "load_single_arch",
image = ":image",
tag = "ghcr.io/malt3/rules_img/python:sideloaded",
)
image_load(
name = "load",
image = ":multiarch_image",
tag = "ghcr.io/malt3/rules_img/python:sideloaded",
)
image_push(
name = "push",
image = ":multiarch_image",
registry = "ghcr.io",
repository = "malt3/rules_img/python",
tag = "latest",
)
build_test(
name = "test",
targets = [
":hello_world_lib",
":hello_world_app",
":layers",
":image",
":multiarch_image",
"load_single_arch",
":load",
":push",
],
)