-
-
Notifications
You must be signed in to change notification settings - Fork 520
/
Copy pathBUILD
52 lines (45 loc) · 1.23 KB
/
BUILD
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
load("@aspect_bazel_lib//lib:tar.bzl", "tar")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_test")
load("@rules_oci//oci:defs.bzl", "oci_image")
package(default_visibility = ["//visibility:public"])
java_library(
name = "java-maven-lib",
srcs = glob(["src/main/java/com/example/myproject/*.java"]),
deps = ["@maven//:com_google_guava_guava"],
)
java_binary(
name = "java-maven",
main_class = "com.example.myproject.App",
runtime_deps = [":java-maven-lib"],
)
java_test(
name = "tests",
srcs = glob(["src/test/java/com/example/myproject/*.java"]),
test_class = "com.example.myproject.TestApp",
deps = [
":java-maven-lib",
"@maven//:com_google_guava_guava",
"@maven//:junit_junit",
],
)
tar(
name = "layer",
srcs = ["java-maven_deploy.jar"],
)
oci_image(
name = "image",
base = "@distroless_java",
entrypoint = [
"java",
"-jar",
"/java-maven-deploy.jar",
],
tars = [":layer"],
)
container_structure_test(
name = "container_test",
configs = ["container-structure-test.yaml"],
image = ":image",
tags = ["requires-docker"],
)