-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Remove rules_docker, make multiarch images canonical #13324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,11 +96,22 @@ http_archive( | |
| ) | ||
|
|
||
| http_archive( | ||
| name = "io_bazel_rules_docker", | ||
| sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf", | ||
| urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"], | ||
| name = "rules_distroless", | ||
| sha256 = "e64f06e452cd153aeab81f752ccf4642955b3af319e64f7bc7a7c9252f76b10e", | ||
| strip_prefix = "rules_distroless-f5e678217b57ce3ad2f1c0204bd4e9d416255773", | ||
| url = "https://github.com/GoogleContainerTools/rules_distroless/archive/f5e678217b57ce3ad2f1c0204bd4e9d416255773.tar.gz", | ||
| ) | ||
|
|
||
| load("@rules_distroless//distroless:dependencies.bzl", "rules_distroless_dependencies") | ||
|
|
||
| rules_distroless_dependencies() | ||
|
|
||
| load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains") | ||
|
|
||
| aspect_bazel_lib_dependencies() | ||
|
|
||
| aspect_bazel_lib_register_toolchains() | ||
|
|
||
| http_archive( | ||
| name = "rules_oci", | ||
| sha256 = "c71c25ed333a4909d2dd77e0b16c39e9912525a98c7fa85144282be8d04ef54c", | ||
|
|
@@ -148,67 +159,16 @@ git_repository( | |
| # gazelle args: -go_prefix github.com/gogo/protobuf -proto legacy | ||
| ) | ||
|
|
||
| load( | ||
| "@io_bazel_rules_docker//repositories:repositories.bzl", | ||
| container_repositories = "repositories", | ||
| ) | ||
|
|
||
| container_repositories() | ||
|
|
||
| load( | ||
| "@io_bazel_rules_docker//container:container.bzl", | ||
| "container_pull", | ||
| ) | ||
|
|
||
| # Pulled gcr.io/distroless/cc-debian11:latest on 2022-02-23 | ||
| container_pull( | ||
| name = "cc_image_base_amd64", | ||
| digest = "sha256:2a0daf90a7deb78465bfca3ef2eee6e91ce0a5706059f05d79d799a51d339523", | ||
| registry = "gcr.io", | ||
| repository = "distroless/cc-debian11", | ||
| ) | ||
|
|
||
| # Pulled gcr.io/distroless/cc-debian11:debug on 2022-02-23 | ||
| container_pull( | ||
| name = "cc_debug_image_base_amd64", | ||
| digest = "sha256:7bd596f5f200588f13a69c268eea6ce428b222b67cd7428d6a7fef95e75c052a", | ||
| registry = "gcr.io", | ||
| repository = "distroless/cc-debian11", | ||
| ) | ||
|
|
||
| # Pulled from gcr.io/distroless/base-debian11:latest on 2022-02-23 | ||
| container_pull( | ||
| name = "go_image_base_amd64", | ||
| digest = "sha256:34e682800774ecbd0954b1663d90238505f1ba5543692dbc75feef7dd4839e90", | ||
| registry = "gcr.io", | ||
| repository = "distroless/base-debian11", | ||
| ) | ||
|
|
||
| # Pulled from gcr.io/distroless/base-debian11:debug on 2022-02-23 | ||
| container_pull( | ||
| name = "go_debug_image_base_amd64", | ||
| digest = "sha256:0f503c6bfd207793bc416f20a35bf6b75d769a903c48f180ad73f60f7b60d7bd", | ||
| registry = "gcr.io", | ||
| repository = "distroless/base-debian11", | ||
| ) | ||
|
|
||
| container_pull( | ||
| name = "alpine_cc_linux_amd64", | ||
| digest = "sha256:752aa0c9a88461ffc50c5267bb7497ef03a303e38b2c8f7f2ded9bebe5f1f00e", | ||
| registry = "index.docker.io", | ||
| repository = "pinglamb/alpine-glibc", | ||
| ) | ||
|
|
||
| load("@rules_oci//oci:pull.bzl", "oci_pull") | ||
|
|
||
| # A multi-arch base image | ||
| oci_pull( | ||
| name = "linux_debian11_multiarch_base", # Debian bullseye | ||
| digest = "sha256:9b8e0854865dcaf49470b4ec305df45957020fbcf17b71eeb50ffd3bc5bf885d", # 2023-05-17 | ||
| digest = "sha256:b82f113425c5b5c714151aaacd8039bc141821cdcd3c65202d42bdf9c43ae60b", # 2023-12-12 | ||
| image = "gcr.io/distroless/cc-debian11", | ||
| platforms = [ | ||
| "linux/amd64", | ||
| "linux/arm64", | ||
| "linux/arm64/v8", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does the v8 here do?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that it's just the long version of arm64. For whatever reason, this image was no longer publishing "linux/arm64" so I had to explicitly set the variant. |
||
| ], | ||
| reproducible = True, | ||
| ) | ||
|
|
@@ -417,24 +377,6 @@ load("@prysm//testing/endtoend:deps.bzl", "e2e_deps") | |
|
|
||
| e2e_deps() | ||
|
|
||
| load( | ||
| "@io_bazel_rules_docker//go:image.bzl", | ||
| _go_image_repos = "repositories", | ||
| ) | ||
|
|
||
| # Golang images | ||
| # This is using gcr.io/distroless/base | ||
| _go_image_repos() | ||
|
|
||
| # CC images | ||
| # This is using gcr.io/distroless/base | ||
| load( | ||
| "@io_bazel_rules_docker//cc:image.bzl", | ||
| _cc_image_repos = "repositories", | ||
| ) | ||
|
|
||
| _cc_image_repos() | ||
|
|
||
| load("@com_github_atlassian_bazel_tools//gometalinter:deps.bzl", "gometalinter_dependencies") | ||
|
|
||
| gometalinter_dependencies() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,5 @@ | ||
| load("@prysm//tools/go:def.bzl", "go_library", "go_test") | ||
| load("@io_bazel_rules_go//go:def.bzl", "go_binary") | ||
| load("@io_bazel_rules_docker//go:image.bzl", "go_image") | ||
| load("@io_bazel_rules_docker//container:container.bzl", "container_bundle", "container_image") | ||
| load("//tools:go_image.bzl", "go_image_debug") | ||
| load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push") | ||
| load("//tools:prysm_image.bzl", "prysm_image_upload") | ||
|
|
||
| go_library( | ||
|
|
@@ -45,69 +41,6 @@ go_library( | |
| ], | ||
| ) | ||
|
|
||
| go_image( | ||
| name = "image", | ||
| base = select({ | ||
| "//tools:base_image_cc": "//tools:cc_image", | ||
| "//conditions:default": "//tools:cc_image", | ||
| }), | ||
| binary = ":beacon-chain", | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| container_image( | ||
| name = "image_with_creation_time", | ||
| base = "image", | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| container_bundle( | ||
| name = "image_bundle", | ||
| images = { | ||
| "gcr.io/prysmaticlabs/prysm/beacon-chain:latest": ":image_with_creation_time", | ||
| "gcr.io/prysmaticlabs/prysm/beacon-chain:{DOCKER_TAG}": ":image_with_creation_time", | ||
| "index.docker.io/prysmaticlabs/prysm-beacon-chain:latest": ":image_with_creation_time", | ||
| "index.docker.io/prysmaticlabs/prysm-beacon-chain:{DOCKER_TAG}": ":image_with_creation_time", | ||
| }, | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| go_image_debug( | ||
| name = "image_debug", | ||
| image = ":image", | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| container_bundle( | ||
| name = "image_bundle_debug", | ||
| images = { | ||
| "gcr.io/prysmaticlabs/prysm/beacon-chain:latest-debug": ":image_debug", | ||
| "gcr.io/prysmaticlabs/prysm/beacon-chain:{DOCKER_TAG}-debug": ":image_debug", | ||
| "index.docker.io/prysmaticlabs/prysm-beacon-chain:latest-debug": ":image_debug", | ||
| "index.docker.io/prysmaticlabs/prysm-beacon-chain:{DOCKER_TAG}-debug": ":image_debug", | ||
| }, | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| docker_push( | ||
| name = "push_images", | ||
| bundle = ":image_bundle", | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| docker_push( | ||
| name = "push_images_debug", | ||
| bundle = ":image_bundle_debug", | ||
| tags = ["manual"], | ||
| visibility = ["//beacon-chain:__pkg__"], | ||
| ) | ||
|
|
||
| go_binary( | ||
| name = "beacon-chain", | ||
| embed = [":go_default_library"], | ||
|
|
@@ -134,12 +67,12 @@ go_test( | |
| ) | ||
|
|
||
| prysm_image_upload( | ||
| name = "push_oci_image", | ||
| name = "push_images", | ||
| binary = ":beacon-chain", | ||
| entrypoint = ["/beacon-chain"], | ||
| repository = "gcr.io/prylabs-dev/prysm/beacon-chain", | ||
| repository = "gcr.io/prysmaticlabs/prysm/beacon-chain", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't related right? this just fixes the namespace?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part is the "make multiarch images canonical" half of the PR. |
||
| symlinks = { | ||
| # Backwards compatiability for images that depended on the old filepath. | ||
| # Backwards compatibility for images that depended on the old filepath. | ||
| "/app/cmd/beacon-chain/beacon-chain": "/beacon-chain", | ||
| }, | ||
| tags = ["manual"], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does https://github.com/GoogleContainerTools/rules_distroless act as an alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rules_docker is deprecated and is no longer supported.
rules_distroless offers some of the functionality that rules_docker supported. Specifically, it replaced the passwd.tar generation in tools/BUILD.bazel