Serge Bazanski | 8506af2 | 2021-01-29 23:55:13 +0100 | [diff] [blame] | 1 | load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer", "container_push") |
Serge Bazanski | ec7e0a9 | 2020-11-05 20:47:01 +0100 | [diff] [blame] | 2 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") |
| 3 | |
| 4 | go_library( |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 5 | name = "wellknown_lib", |
Serge Bazanski | ec7e0a9 | 2020-11-05 20:47:01 +0100 | [diff] [blame] | 6 | srcs = ["main.go"], |
| 7 | importpath = "code.hackerspace.pl/hscloud/app/matrix/wellknown", |
| 8 | visibility = ["//visibility:private"], |
| 9 | deps = [ |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 10 | "//go/mirko", |
| 11 | "@com_github_golang_glog//:glog", |
Serge Bazanski | ec7e0a9 | 2020-11-05 20:47:01 +0100 | [diff] [blame] | 12 | ], |
| 13 | ) |
| 14 | |
| 15 | go_binary( |
| 16 | name = "wellknown", |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 17 | embed = [":wellknown_lib"], |
Serge Bazanski | ec7e0a9 | 2020-11-05 20:47:01 +0100 | [diff] [blame] | 18 | visibility = ["//visibility:public"], |
| 19 | ) |
| 20 | |
| 21 | go_test( |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 22 | name = "wellknown_test", |
Serge Bazanski | ec7e0a9 | 2020-11-05 20:47:01 +0100 | [diff] [blame] | 23 | srcs = ["server_test.go"], |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 24 | embed = [":wellknown_lib"], |
| 25 | deps = ["@com_github_go_test_deep//:deep"], |
Serge Bazanski | ec7e0a9 | 2020-11-05 20:47:01 +0100 | [diff] [blame] | 26 | ) |
Serge Bazanski | 8506af2 | 2021-01-29 23:55:13 +0100 | [diff] [blame] | 27 | |
| 28 | container_layer( |
| 29 | name = "layer_bin", |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 30 | directory = "/app/matrix/", |
Serge Bazanski | 8506af2 | 2021-01-29 23:55:13 +0100 | [diff] [blame] | 31 | files = [ |
| 32 | ":wellknown", |
| 33 | ], |
Serge Bazanski | 8506af2 | 2021-01-29 23:55:13 +0100 | [diff] [blame] | 34 | ) |
| 35 | |
| 36 | container_image( |
| 37 | name = "runtime", |
| 38 | base = "@prodimage-bionic//image", |
| 39 | layers = [ |
| 40 | ":layer_bin", |
| 41 | ], |
| 42 | ) |
| 43 | |
| 44 | container_push( |
| 45 | name = "push", |
Serge Bazanski | 8506af2 | 2021-01-29 23:55:13 +0100 | [diff] [blame] | 46 | format = "Docker", |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 47 | image = ":runtime", |
Serge Bazanski | 8506af2 | 2021-01-29 23:55:13 +0100 | [diff] [blame] | 48 | registry = "registry.k0.hswaw.net", |
| 49 | repository = "q3k/wellknown", |
| 50 | tag = "{BUILD_TIMESTAMP}-{STABLE_GIT_COMMIT}", |
| 51 | ) |