blob: 88bf9676f9b4eacd0f48858a66aef3080e978fc6 [file] [log] [blame]
Serge Bazanski8506af22021-01-29 23:55:13 +01001load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer", "container_push")
Serge Bazanskiec7e0a92020-11-05 20:47:01 +01002load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
3
4go_library(
Serge Bazanski97b5cd72023-07-28 17:14:50 +00005 name = "wellknown_lib",
Serge Bazanskiec7e0a92020-11-05 20:47:01 +01006 srcs = ["main.go"],
7 importpath = "code.hackerspace.pl/hscloud/app/matrix/wellknown",
8 visibility = ["//visibility:private"],
9 deps = [
Serge Bazanski97b5cd72023-07-28 17:14:50 +000010 "//go/mirko",
11 "@com_github_golang_glog//:glog",
Serge Bazanskiec7e0a92020-11-05 20:47:01 +010012 ],
13)
14
15go_binary(
16 name = "wellknown",
Serge Bazanski97b5cd72023-07-28 17:14:50 +000017 embed = [":wellknown_lib"],
Serge Bazanskiec7e0a92020-11-05 20:47:01 +010018 visibility = ["//visibility:public"],
19)
20
21go_test(
Serge Bazanski97b5cd72023-07-28 17:14:50 +000022 name = "wellknown_test",
Serge Bazanskiec7e0a92020-11-05 20:47:01 +010023 srcs = ["server_test.go"],
Serge Bazanski97b5cd72023-07-28 17:14:50 +000024 embed = [":wellknown_lib"],
25 deps = ["@com_github_go_test_deep//:deep"],
Serge Bazanskiec7e0a92020-11-05 20:47:01 +010026)
Serge Bazanski8506af22021-01-29 23:55:13 +010027
28container_layer(
29 name = "layer_bin",
Serge Bazanski97b5cd72023-07-28 17:14:50 +000030 directory = "/app/matrix/",
Serge Bazanski8506af22021-01-29 23:55:13 +010031 files = [
32 ":wellknown",
33 ],
Serge Bazanski8506af22021-01-29 23:55:13 +010034)
35
36container_image(
37 name = "runtime",
38 base = "@prodimage-bionic//image",
39 layers = [
40 ":layer_bin",
41 ],
42)
43
44container_push(
45 name = "push",
Serge Bazanski8506af22021-01-29 23:55:13 +010046 format = "Docker",
Serge Bazanski97b5cd72023-07-28 17:14:50 +000047 image = ":runtime",
Serge Bazanski8506af22021-01-29 23:55:13 +010048 registry = "registry.k0.hswaw.net",
49 repository = "q3k/wellknown",
50 tag = "{BUILD_TIMESTAMP}-{STABLE_GIT_COMMIT}",
51)