From 0a4329de1d13447581767793f2d505edfef4c1bf Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 7 Sep 2021 23:26:15 +0400 Subject: [PATCH] add more docker images --- .github/workflows/bazel-build.yml | 14 +++++++------- BUILD | 3 +++ bazel/docker.bzl | 12 ++++++++++-- gateway/BUILD | 9 +++++++++ ratelimiter/BUILD | 8 ++++++++ third_party/BUILD | 1 - third_party/crate_universe_defaults.bzl | 14 -------------- webhook/BUILD | 10 +++++++++- 8 files changed, 46 insertions(+), 25 deletions(-) delete mode 100644 third_party/BUILD delete mode 100644 third_party/crate_universe_defaults.bzl diff --git a/.github/workflows/bazel-build.yml b/.github/workflows/bazel-build.yml index 3e423f9..20d7f54 100644 --- a/.github/workflows/bazel-build.yml +++ b/.github/workflows/bazel-build.yml @@ -21,6 +21,13 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + - uses: docker-practice/actions-setup-docker@master + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Setup Bazelisk # You may pin to the exact commit or the version. # uses: bazelbuild/setup-bazelisk@2351cf5a7584ce72638fbce7c22e5128a5fcd5b2 @@ -56,13 +63,6 @@ jobs: bazel-bin*/package_tar.tar.gz - name: Setup docker - - uses: docker-practice/actions-setup-docker@master - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - name: Publish docker images shell: bash run: | diff --git a/BUILD b/BUILD index 78fd897..31ccc06 100644 --- a/BUILD +++ b/BUILD @@ -21,6 +21,9 @@ container_bundle( images = { "ghcr.io/discordnova/nova/novactl:latest": "//novactl:image", + "ghcr.io/discordnova/nova/gateway:latest": "//gateway:image", + "ghcr.io/discordnova/nova/ratelimiter:latest": "//ratelimiter:image", + "ghcr.io/discordnova/nova/webhook:latest": "//webhook:image", } ) diff --git a/bazel/docker.bzl b/bazel/docker.bzl index 54ac81c..6b42a69 100644 --- a/bazel/docker.bzl +++ b/bazel/docker.bzl @@ -3,16 +3,24 @@ load("@io_bazel_rules_docker//toolchains/docker:toolchain.bzl", "toolchain_configure") load("@io_bazel_rules_docker//repositories:repositories.bzl", "repositories") load("@io_bazel_rules_docker//repositories:deps.bzl", "deps") -load("@io_bazel_rules_docker//container:container.bzl", "container_pull") load( "@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories", ) +load( + "@io_bazel_rules_docker//rust:image.bzl", + _rust_image_repos = "repositories", +) + def load_docker(): + """ + Loads all the docker credentials and pull the needed images + """ toolchain_configure( name = "docker_config" ) repositories() deps() - _go_image_repos() \ No newline at end of file + _go_image_repos() + _rust_image_repos() \ No newline at end of file diff --git a/gateway/BUILD b/gateway/BUILD index 54df7af..f1078df 100644 --- a/gateway/BUILD +++ b/gateway/BUILD @@ -1,5 +1,6 @@ load("@rules_rust//rust:rust.bzl", "rust_binary") load("//cargo:crates.bzl", "all_crate_deps", "crate_deps") +load("@io_bazel_rules_docker//rust:image.bzl", "rust_image") exports_files(["Cargo.toml"]) @@ -10,3 +11,11 @@ rust_binary( deps = all_crate_deps(), visibility = ["//visibility:public"], ) + +rust_image( + name = "image", + srcs = glob(["src/**/*.rs"]), + proc_macro_deps = crate_deps(["serde_repr"]), + deps = all_crate_deps(), + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/ratelimiter/BUILD b/ratelimiter/BUILD index 167e80f..3a8b2e4 100644 --- a/ratelimiter/BUILD +++ b/ratelimiter/BUILD @@ -1,6 +1,7 @@ load("@rules_rust//rust:rust.bzl", "rust_binary") load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") load("//cargo:crates.bzl", "all_crate_deps", "crate_deps") +load("@io_bazel_rules_docker//rust:image.bzl", "rust_image") exports_files(["Cargo.toml"]) @@ -26,3 +27,10 @@ rust_binary( deps = all_crate_deps() + [":build_script"], visibility = ["//visibility:public"], ) + +rust_image( + name = "image", + srcs = ["src/main.rs"], + deps = all_crate_deps() + [":build_script"], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/third_party/BUILD b/third_party/BUILD deleted file mode 100644 index be277cb..0000000 --- a/third_party/BUILD +++ /dev/null @@ -1 +0,0 @@ -exports_files(["create_universe_defaults.bzl"]) \ No newline at end of file diff --git a/third_party/crate_universe_defaults.bzl b/third_party/crate_universe_defaults.bzl deleted file mode 100644 index c32a00e..0000000 --- a/third_party/crate_universe_defaults.bzl +++ /dev/null @@ -1,14 +0,0 @@ -"""A helper module defining generated information about crate_universe dependencies""" - -# This global should match the current release of `crate_unvierse`. -DEFAULT_URL_TEMPLATE = "https://github.com/bazelbuild/rules_rust/releases/download/crate_universe-12/crate_universe_resolver-{host_triple}{extension}" - -# Note that if any additional platforms are added here, the pipeline defined -# by `create_universe.yaml` should also be updated -DEFAULT_SHA256_CHECKSUMS = { - "aarch64-apple-darwin": "c6017cd8a4fee0f1796a8db184e9d64445dd340b7f48a65130d7ee61b97051b4", - "aarch64-unknown-linux-gnu": "d0a310b03b8147e234e44f6a93e8478c260a7c330e5b35515336e7dd67150f35", - "x86_64-apple-darwin": "762f1c77b3cf1de8e84d7471442af1314157efd90720c7e1f2fff68556830ee2", - "x86_64-pc-windows-gnu": "8fa9a00812f3e2f6ac2678e3bce2d8415f3dc8ef926b590d4f855cc696af7c8d", - "x86_64-unknown-linux-gnu": "aebf51af6a3dd33fdac463b35b0c3f4c47ab93e052099199673289e2025e5824", -} \ No newline at end of file diff --git a/webhook/BUILD b/webhook/BUILD index e33a21d..84c04f6 100644 --- a/webhook/BUILD +++ b/webhook/BUILD @@ -1,5 +1,6 @@ load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_test") -load("//cargo:crates.bzl", "all_crate_deps", "crate_deps") +load("//cargo:crates.bzl", "all_crate_deps") +load("@io_bazel_rules_docker//rust:image.bzl", "rust_image") exports_files(["Cargo.toml"]) @@ -14,4 +15,11 @@ rust_test( name = "webhook_test", crate = ":webhook", deps = all_crate_deps(), +) + +rust_image( + name = "image", + srcs = glob(["src/**"]), + deps = all_crate_deps(), + visibility = ["//visibility:public"], ) \ No newline at end of file -- 2.39.5