-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUILD.bazel
87 lines (78 loc) · 2.38 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
85
86
87
# Add rules here to build your software
# See https://docs.bazel.build/versions/master/build-ref.html#BUILD_files
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@com_kindlyops_rules_manifest//:manifest.bzl", "docker_manifest", "lambda_manifest")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
# Allow any ts_library rules in this workspace to reference the config
# Note: if you move the tsconfig.json file to a subdirectory, you can add an alias() here instead
# so that ts_library rules still use it by default.
# See https://www.npmjs.com/package/@bazel/typescript#installation
exports_files(
[
"tsconfig.json",
"jest.config.js",
],
visibility = ["//visibility:public"],
)
nodejs_binary(
name = "cdk",
args = [
"--app $(location //lib:app)",
],
data = [
"tsconfig.json",
"//lib",
"//lib:app",
"@com_github_kindlyops_pipeline_monitor//:lambda_deploy",
"@npm//:node_modules",
],
entry_point = "@npm//:node_modules/aws-cdk/bin/cdk",
# https://github.com/bazelbuild/rules_nodejs/pull/2344
templated_args = ["--bazel_patch_module_resolver"],
visibility = ["//visibility:public"],
)
genrule(
name = "synth",
srcs = [
"@com_github_kindlyops_pipeline_monitor//:lambda_deploy",
"//lambdas/demo:lambda_zip",
"//lambdas/demo2:lambda_zip",
],
outs = ["synth.tar"],
cmd = """rm -rf `dirname $@`/cdk.out && $(execpath //lib:app) \
`dirname $@`/cdk.out \
$(BINDIR) \
&& tar -C `dirname $@`/cdk.out -cf $@ .
""",
tools = ["//lib:app"],
)
# gazelle:prefix github.com/kindlyops/bazel-cdk-demo
gazelle(name = "gazelle")
lambda_manifest(
name = "lambdamanifest",
srcs = [
"//lambdas/demo:lambda_zip",
"//lambdas/demo2:lambda_zip",
"@com_github_kindlyops_pipeline_monitor//:lambda_deploy",
],
)
go_image(
name = "container",
binary = "@com_github_containous_whoami//:whoami",
)
container_push(
name = "push",
format = "Docker",
image = ":container",
registry = "gcr.io",
repository = "example-service",
visibility = ["//visibility:public"],
)
docker_manifest(
name = "containermanifest",
srcs = [
":push.digest",
],
)