Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 16 additions & 74 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

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

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",
Expand Down Expand Up @@ -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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the v8 here do?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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.

Also see: https://github.com/docker-library/official-images#architectures-other-than-amd64

],
reproducible = True,
)
Expand Down Expand Up @@ -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()
Expand Down
73 changes: 3 additions & 70 deletions cmd/beacon-chain/BUILD.bazel
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(
Expand Down Expand Up @@ -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"],
Expand All @@ -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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't related right? this just fixes the namespace?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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"],
Expand Down
67 changes: 2 additions & 65 deletions cmd/prysmctl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
load("@prysm//tools/go:def.bzl", "go_library")
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(
Expand All @@ -24,65 +20,6 @@ go_library(
],
)

go_image(
name = "image",
base = select({
"//tools:base_image_cc": "//tools:cc_image",
"//conditions:default": "//tools:cc_image",
}),
binary = ":prysmctl",
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

container_image(
name = "image_with_creation_time",
base = "image",
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

container_bundle(
name = "image_bundle",
images = {
"gcr.io/prysmaticlabs/prysm/cmd/prysmctl:latest": ":image_with_creation_time",
"gcr.io/prysmaticlabs/prysm/cmd/prysmctl:{DOCKER_TAG}": ":image_with_creation_time",
},
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

go_image_debug(
name = "image_debug",
image = ":image",
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

container_bundle(
name = "image_bundle_debug",
images = {
"gcr.io/prysmaticlabs/prysm/cmd/prysmctl:latest-debug": ":image_debug",
"gcr.io/prysmaticlabs/prysm/cmd/prysmctl:{DOCKER_TAG}-debug": ":image_debug",
},
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

docker_push(
name = "push_images",
bundle = ":image_bundle",
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

docker_push(
name = "push_images_debug",
bundle = ":image_bundle_debug",
tags = ["manual"],
visibility = ["//cmd/prysmctl:__pkg__"],
)

go_binary(
name = "prysmctl",
embed = [":go_default_library"],
Expand All @@ -91,10 +28,10 @@ go_binary(
)

prysm_image_upload(
name = "push_oci_image",
name = "push_images",
binary = ":prysmctl",
entrypoint = ["/prysmctl"],
repository = "gcr.io/prylabs-dev/prysm/prysmctl",
repository = "gcr.io/prysmaticlabs/prysm/cmd/prysmctl",
symlinks = {
# Backwards compatiability for images that depended on the old filepath.
"/app/cmd/prysmctl/prysmctl": "/prysmctl",
Expand Down
71 changes: 2 additions & 69 deletions cmd/validator/BUILD.bazel
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(
Expand Down Expand Up @@ -39,69 +35,6 @@ go_library(
],
)

go_image(
name = "image",
base = select({
"//tools:base_image_cc": "//tools:cc_image",
"//conditions:default": "//tools:cc_image",
}),
binary = ":validator",
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

container_image(
name = "image_with_creation_time",
base = "image",
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

container_bundle(
name = "image_bundle",
images = {
"gcr.io/prysmaticlabs/prysm/validator:latest": ":image_with_creation_time",
"gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}": ":image_with_creation_time",
"index.docker.io/prysmaticlabs/prysm-validator:latest": ":image_with_creation_time",
"index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}": ":image_with_creation_time",
},
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

go_image_debug(
name = "image_debug",
image = ":image",
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

container_bundle(
name = "image_bundle_debug",
images = {
"gcr.io/prysmaticlabs/prysm/validator:latest-debug": ":image_debug",
"gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-debug": ":image_debug",
"index.docker.io/prysmaticlabs/prysm-validator:latest-debug": ":image_debug",
"index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-debug": ":image_debug",
},
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

docker_push(
name = "push_images",
bundle = ":image_bundle",
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

docker_push(
name = "push_images_debug",
bundle = ":image_bundle_debug",
tags = ["manual"],
visibility = ["//validator:__pkg__"],
)

go_binary(
name = "validator",
embed = [":go_default_library"],
Expand All @@ -124,10 +57,10 @@ go_test(
)

prysm_image_upload(
name = "push_oci_image",
name = "push_images",
binary = ":validator",
entrypoint = ["/validator"],
repository = "gcr.io/prylabs-dev/prysm/validator",
repository = "gcr.io/prysmaticlabs/prysm/validator",
symlinks = {
# Backwards compatiability for images that depended on the old filepath.
"/app/cmd/validator/validator": "/validator",
Expand Down
Loading