-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBUILD.bazel
More file actions
98 lines (89 loc) · 1.96 KB
/
BUILD.bazel
File metadata and controls
98 lines (89 loc) · 1.96 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
load("@buildx//:defs.bzl", "buildx", "context")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
package(default_visibility = ["//visibility:public"])
buildx(
name = "base_buildx_image",
build_context = [
context.oci_layout(
"ubuntu:latest",
"@ubuntu",
),
],
dockerfile = ":Dockerfile-base",
)
oci_image(
name = "base_oci_image",
base = ":base_buildx_image",
)
oci_load(
name = "base.load",
image = ":base_oci_image",
repo_tags = ["base:latest"],
)
buildx(
name = "dev_buildx_image",
build_context = [
context.oci_layout(
"base:latest",
":base_oci_image",
),
],
dockerfile = ":Dockerfile-dev",
)
oci_image(
name = "dev_oci_image",
base = ":dev_buildx_image",
)
oci_load(
name = "dev.load",
image = ":dev_oci_image",
repo_tags = ["dev:latest"],
)
genrule(
name = "base_details",
srcs = [
":base_oci_image",
],
outs = [
"base.label",
"base.digest",
],
cmd = """set -ex;
$(location :base.load) | awk -F: '/Loaded image:/ { print $$2 ":" $$3 }' > $(location :base.label);
docker images --quiet --no-trunc $$(cat $(location :base.label)) > $(location :base.digest);
""",
tags = [
"no-cache",
"no-sandbox",
],
target_compatible_with = [
"@docker_config//:docker_yes",
],
tools = [
":base.load",
],
)
genrule(
name = "dev_details",
srcs = [
":dev_oci_image",
],
outs = [
"dev.label",
"dev.digest",
],
cmd = """set -ex;
$(location :dev.load) | awk -F: '/Loaded image:/ { print $$2 ":" $$3 }' > $(location :dev.label);
docker images --quiet --no-trunc $$(cat $(location :dev.label)) > $(location :dev.digest);
""",
tags = [
"no-cache",
"no-sandbox",
],
target_compatible_with = [
"@docker_config//:docker_yes",
],
tools = [
":dev.load",
],
)