mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 00:27:38 +00:00
02ee6897bb
* Add bazel-zig-cc for a hermetic cc toolchain * gazelle * Remove llvm * remove wl * Add new URLs for renamed repo * gazelle * Update to v2.0.0-rc1 * bump to rc2 * Proof of concept multi-arch containers for beacon-chain * TODO and gaz * Refactor to starlark macro. Use a version of bash that actually works * progress * gaz * multirun to use multiple repositories, but doesn't work with tag stamping * Revert "multirun to use multiple repositories, but doesn't work with tag stamping" This reverts commit 93afa76f65daeba9426c3d714dabf94410fa3a0c. * Add targets for all supported docker images and temporarily set the repository to prysm-dev for testing * use a temporary fix to see if it works on buildkite * Revert "use a temporary fix to see if it works on buildkite" This reverts commit ddc79283caa6b39c8aff4c62772728832d0dfe64. * testing a cURL fix * try fix with my fix * Revert "try fix with my fix" This reverts commit bb7521bf4712abb6779bbf3132e64911b751db65. * Revert "testing a cURL fix" This reverts commit 8a4782110f8853cb7278baf507621bd6684572b1. * try tip of main branch for rules_oci * update to 1.2.0 * Update rules_oci to v1.3.0 * Update rule_oci to 1.3.4 * Disable experimental_remote_downloader * Remove extra zig bazelrc * Move image deps to its own file * PR feedback --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
128 lines
3.5 KiB
Python
128 lines
3.5 KiB
Python
load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
|
|
load("@io_bazel_rules_docker//contrib:passwd.bzl", "passwd_entry", "passwd_file")
|
|
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
|
|
load("//tools:build_settings.bzl", "base_image")
|
|
|
|
################################################################################
|
|
## Docker images as non-root user ##
|
|
################################################################################
|
|
|
|
# Create a passwd file with a root and nonroot user and uid.
|
|
passwd_entry(
|
|
name = "root_user",
|
|
gid = 0,
|
|
tags = ["manual"],
|
|
uid = 0,
|
|
username = "root",
|
|
)
|
|
|
|
passwd_entry(
|
|
name = "nonroot_user",
|
|
info = "nonroot",
|
|
tags = ["manual"],
|
|
uid = 1001,
|
|
username = "nonroot",
|
|
)
|
|
|
|
passwd_file(
|
|
name = "passwd",
|
|
entries = [
|
|
":root_user",
|
|
":nonroot_user",
|
|
],
|
|
tags = ["manual"],
|
|
)
|
|
|
|
# Create a tar file containing the created passwd file
|
|
pkg_tar(
|
|
name = "passwd_tar",
|
|
srcs = [":passwd"],
|
|
mode = "0o644",
|
|
package_dir = "etc",
|
|
tags = ["manual"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
CC_DEFAULT_BASE = select({
|
|
"@io_bazel_rules_docker//:debug": "@cc_debug_image_base_amd64//image",
|
|
"@io_bazel_rules_docker//:fastbuild": "@cc_image_base_amd64//image",
|
|
"@io_bazel_rules_docker//:optimized": "@cc_image_base_amd64//image",
|
|
"//conditions:default": "@cc_image_base_amd64//image",
|
|
})
|
|
|
|
GO_DEFAULT_BASE = select({
|
|
"@io_bazel_rules_docker//:debug": "@go_debug_image_base_amd64//image",
|
|
"@io_bazel_rules_docker//:fastbuild": "@go_image_base_amd64//image",
|
|
"@io_bazel_rules_docker//:optimized": "@go_image_base_amd64//image",
|
|
"//conditions:default": "@go_image_base_amd64//image",
|
|
})
|
|
|
|
# Include it in our base image as a tar.
|
|
container_image(
|
|
name = "cc_image",
|
|
base = CC_DEFAULT_BASE,
|
|
tags = ["manual"],
|
|
tars = [":passwd_tar"],
|
|
user = "root",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
container_image(
|
|
name = "go_image",
|
|
base = GO_DEFAULT_BASE,
|
|
tags = ["manual"],
|
|
tars = [":passwd_tar"],
|
|
user = "root",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
base_image(
|
|
name = "base_image",
|
|
build_setting_default = "cc_image",
|
|
tags = ["manual"],
|
|
)
|
|
|
|
config_setting(
|
|
name = "base_image_alpine",
|
|
flag_values = {"//tools:base_image": "alpine"},
|
|
)
|
|
|
|
config_setting(
|
|
name = "base_image_cc",
|
|
flag_values = {"//tools:base_image": "cc_image"},
|
|
)
|
|
|
|
container_image(
|
|
name = "alpine_cc_image",
|
|
base = "@alpine_cc_linux_amd64//image",
|
|
tags = ["manual"],
|
|
tars = [":passwd_tar"],
|
|
user = "root",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# Create a bash tar layer for docker images. This allows docker images to have access to the "bash"
|
|
# command and improves debugging abilities on the image.
|
|
genrule(
|
|
name = "bash_tar",
|
|
srcs = select({
|
|
"@platforms//cpu:x86_64": ["@bash_amd64//file"],
|
|
"@platforms//cpu:arm64": ["@bash_arm64//file"],
|
|
}),
|
|
outs = ["bash.tar"],
|
|
cmd = "ar x $< && xz -d data.tar.xz -c >> $@",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# libtinfo6 is required for terminal activity and contains terminfo library.
|
|
genrule(
|
|
name = "libtinfo6_tar",
|
|
srcs = select({
|
|
"@platforms//cpu:x86_64": ["@libtinfo6_amd64//file"],
|
|
"@platforms//cpu:arm64": ["@libtinfo6_arm64//file"],
|
|
}),
|
|
outs = ["libtinfo6.tar"],
|
|
cmd = "ar x $< && xz -d data.tar.xz -c >> $@",
|
|
visibility = ["//visibility:public"],
|
|
)
|