This repository was archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBUILD.bazel
112 lines (101 loc) · 3.23 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push")
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("@io_bazel_rules_docker//contrib:passwd.bzl", "passwd_entry", "passwd_file")
# gazelle:prefix github.com/prysmaticlabs/prysmbot
gazelle(name = "gazelle")
go_library(
name = "go_default_library",
srcs = [
"block.go",
"channels.go",
"commands.go",
"current.go",
"denylist.go",
"food.go",
"goerli.go",
"help.go",
"main.go",
"random.go",
"state.go",
"types.go",
"user.go",
"validator.go",
],
importpath = "github.com/prysmaticlabs/prysmbot",
visibility = ["//visibility:private"],
deps = [
"@com_github_bwmarrin_discordgo//:go_default_library",
"@com_github_ethereum_go_ethereum//accounts/keystore:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//core/types:go_default_library",
"@com_github_ethereum_go_ethereum//crypto:go_default_library",
"@com_github_ethereum_go_ethereum//ethclient:go_default_library",
"@com_github_fsnotify_fsnotify//:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@com_github_prysmaticlabs_prysm//shared/params:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_wealdtech_go_bytesutil//:go_default_library",
"@org_golang_google_grpc//:go_default_library",
],
)
go_binary(
name = "prysmbot",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
go_image(
name = "go_image",
base = ":go_image_base",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
################################################################################
## Docker images as non-root user ##
################################################################################
# Create a passwd file with a root and nonroot user and uid.
passwd_entry(
name = "root_user",
gid = 0,
uid = 0,
username = "root",
)
passwd_entry(
name = "nonroot_user",
info = "nonroot",
uid = 1001,
username = "nonroot",
)
passwd_file(
name = "passwd",
entries = [
":root_user",
":nonroot_user",
],
)
# Create a tar file containing the created passwd file
pkg_tar(
name = "passwd_tar",
srcs = [":passwd"],
mode = "0o644",
package_dir = "etc",
)
container_image(
name = "go_image_base",
base = "@go_image_base//image",
tars = [":passwd_tar"],
user = "nonroot",
visibility = ["//visibility:public"],
)
container_push(
name = "push_image",
format = "Docker",
image = ":go_image",
registry = "gcr.io",
repository = "prysmaticlabs/prysmbot",
tag = "latest",
)