-
Notifications
You must be signed in to change notification settings - Fork 37
/
BUILD.bazel
84 lines (78 loc) · 1.79 KB
/
BUILD.bazel
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
load("@aspect_bazel_lib//lib:tar.bzl", "tar")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_distroless//distroless:defs.bzl", "group", "passwd")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
passwd(
name = "passwd",
entries = [
{
"uid": 0,
"gid": 0,
"home": "/root",
"shell": "/bin/bash",
"username": "r00t",
},
{
"uid": 100,
"gid": 65534,
"home": "/home/_apt",
"shell": "/usr/sbin/nologin",
"username": "_apt",
},
],
)
group(
name = "group",
entries = [
{
"name": "root",
"gid": 0,
},
{
"name": "_apt",
"gid": 65534,
},
],
)
tar(
name = "sh",
mtree = [
# needed as dpkg assumes sh is installed in a typical debian installation.
"./bin/sh type=link link=/bin/bash",
],
)
oci_image(
name = "noble",
architecture = select({
"@platforms//cpu:arm64": "arm64",
"@platforms//cpu:x86_64": "amd64",
}),
os = "linux",
tars = [
":sh",
":passwd",
":group",
"@noble//:noble",
],
)
oci_load(
name = "tarball",
image = ":noble",
repo_tags = [
"distroless/noble:latest",
],
)
container_structure_test(
name = "test",
configs = select({
"@platforms//cpu:arm64": ["test_linux_arm64.yaml"],
"@platforms//cpu:x86_64": ["test_linux_amd64.yaml"],
}),
image = ":noble",
target_compatible_with = select({
"@platforms//cpu:x86_64": ["@platforms//cpu:x86_64"],
"@platforms//cpu:arm64": ["@platforms//cpu:arm64"],
}) + [
"@platforms//os:linux",
],
)