From c28f231041ebbef4c146c2b491e4cfb321fbdf4e Mon Sep 17 00:00:00 2001 From: AmrikSD Date: Thu, 5 Dec 2024 00:24:41 +0000 Subject: [PATCH] make pulling images a bit more modular --- MODULE.bazel | 75 +------------------ MODULE.bazel.lock | 16 ++-- infra/containers/BUILD | 0 infra/containers/containers.MODULE.bazel | 8 ++ infra/containers/distroless/BUILD | 0 .../distroless/distroless.MODULE.bazel | 25 +++++++ infra/containers/nginx/BUILD | 0 infra/containers/nginx/nginx.MODULE.bazel | 32 ++++++++ .../containers/registry/registry.MODULE.bazel | 28 +++++++ 9 files changed, 103 insertions(+), 81 deletions(-) create mode 100644 infra/containers/BUILD create mode 100644 infra/containers/containers.MODULE.bazel create mode 100644 infra/containers/distroless/BUILD create mode 100644 infra/containers/distroless/distroless.MODULE.bazel create mode 100644 infra/containers/nginx/BUILD create mode 100644 infra/containers/nginx/nginx.MODULE.bazel create mode 100644 infra/containers/registry/registry.MODULE.bazel diff --git a/MODULE.bazel b/MODULE.bazel index c8b78dd..4515e24 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,10 +4,10 @@ bazel_dep(name = "rules_jvm_external", version = "6.2") bazel_dep(name = "contrib_rules_jvm", version = "0.27.0") bazel_dep(name = "rules_go", version = "0.50.1") bazel_dep(name = "rules_pkg", version = "1.0.1") -bazel_dep(name = "rules_oci", version = "2.0.1") + +include("//infra/containers:containers.MODULE.bazel") maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") -oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") # Version variables # renovate: datasource=maven depName=com.google.inject:guice-bom @@ -96,74 +96,3 @@ maven.install( use_repo(maven, "maven") -oci.pull( - name = "nginx", - image = "docker.io/library/nginx", - digest = "sha256:28402db69fec7c17e179ea87882667f1e054391138f77ffaf0c3eb388efc3ffb", - platforms = [ - "linux/386", - "linux/amd64", - "linux/arm/v5", - "linux/arm/v7", - "linux/arm64/v8", - "linux/mips64le", - "linux/ppc64le", - "linux/s390x" - ] -) - -oci.pull( - name = "registry", - image = "docker.io/library/registry", - digest = "sha256:ac0192b549007e22998eb74e8d8488dcfe70f1489520c3b144a6047ac5efbe90", - platforms = [ - "linux/amd64", - "linux/arm/v6", - "linux/arm/v7", - "linux/arm64/v8", - "linux/ppc64le", - "linux/s390x", - ] -) - -oci.pull( - name = "distroless", - image = "gcr.io/distroless/static", - digest = "sha256:cc226ca14d17d01d4b278d9489da930a0dd11150df10ae95829d13e6d00fbdbf", - platforms = [ - "linux/amd64", - "linux/arm/v7", - "linux/arm64/v8", - "linux/s390x", - "linux/ppc64le", - ] -) - -use_repo( - oci, - "distroless", - "distroless_linux_amd64", - "distroless_linux_arm_v7", - "distroless_linux_arm64_v8", - "distroless_linux_s390x", - "distroless_linux_ppc64le", - - "nginx", - "nginx_linux_386", - "nginx_linux_amd64", - "nginx_linux_arm_v5", - "nginx_linux_arm_v7", - "nginx_linux_arm64_v8", - "nginx_linux_mips64le", - "nginx_linux_ppc64le", - "nginx_linux_s390x", - - "registry", - "registry_linux_amd64", - "registry_linux_arm_v6", - "registry_linux_arm_v7", - "registry_linux_arm64_v8", - "registry_linux_ppc64le", - "registry_linux_s390x", -) - diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 5c8a402..67a291d 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -714,7 +714,7 @@ "@@rules_oci~//oci:extensions.bzl%oci": { "general": { "bzlTransitiveDigest": "jN4U6rNDYr+4BPf/l/XG98DSMLO6QJaOTNWrZtt8Auo=", - "usagesDigest": "iD7hJlCnE9lImbLpw0NscRLamrrt1v9RqnBFt+ZmKKk=", + "usagesDigest": "YSHkgWsCp5iKihGEXqJ+Gs60a/g5FqDsbraDAE07WQ0=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -1414,6 +1414,12 @@ }, "moduleExtensionMetadata": { "explicitRootModuleDirectDeps": [ + "distroless", + "distroless_linux_amd64", + "distroless_linux_arm_v7", + "distroless_linux_arm64_v8", + "distroless_linux_s390x", + "distroless_linux_ppc64le", "nginx", "nginx_linux_386", "nginx_linux_amd64", @@ -1429,13 +1435,7 @@ "registry_linux_arm_v7", "registry_linux_arm64_v8", "registry_linux_ppc64le", - "registry_linux_s390x", - "distroless", - "distroless_linux_amd64", - "distroless_linux_arm_v7", - "distroless_linux_arm64_v8", - "distroless_linux_s390x", - "distroless_linux_ppc64le" + "registry_linux_s390x" ], "explicitRootModuleDirectDevDeps": [], "useAllRepos": "NO", diff --git a/infra/containers/BUILD b/infra/containers/BUILD new file mode 100644 index 0000000..e69de29 diff --git a/infra/containers/containers.MODULE.bazel b/infra/containers/containers.MODULE.bazel new file mode 100644 index 0000000..fa493f3 --- /dev/null +++ b/infra/containers/containers.MODULE.bazel @@ -0,0 +1,8 @@ +bazel_dep(name = "rules_oci", version = "2.0.1") + +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") + +include("//infra/containers/distroless:distroless.MODULE.bazel") +include("//infra/containers/nginx:nginx.MODULE.bazel") +include("//infra/containers/registry:registry.MODULE.bazel") + diff --git a/infra/containers/distroless/BUILD b/infra/containers/distroless/BUILD new file mode 100644 index 0000000..e69de29 diff --git a/infra/containers/distroless/distroless.MODULE.bazel b/infra/containers/distroless/distroless.MODULE.bazel new file mode 100644 index 0000000..21d6481 --- /dev/null +++ b/infra/containers/distroless/distroless.MODULE.bazel @@ -0,0 +1,25 @@ +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") + +oci.pull( + name = "distroless", + image = "gcr.io/distroless/static", + digest = "sha256:cc226ca14d17d01d4b278d9489da930a0dd11150df10ae95829d13e6d00fbdbf", + platforms = [ + "linux/amd64", + "linux/arm/v7", + "linux/arm64/v8", + "linux/s390x", + "linux/ppc64le", + ] +) + +use_repo( + oci, + "distroless", + "distroless_linux_amd64", + "distroless_linux_arm_v7", + "distroless_linux_arm64_v8", + "distroless_linux_s390x", + "distroless_linux_ppc64le", +) + diff --git a/infra/containers/nginx/BUILD b/infra/containers/nginx/BUILD new file mode 100644 index 0000000..e69de29 diff --git a/infra/containers/nginx/nginx.MODULE.bazel b/infra/containers/nginx/nginx.MODULE.bazel new file mode 100644 index 0000000..32ca5b7 --- /dev/null +++ b/infra/containers/nginx/nginx.MODULE.bazel @@ -0,0 +1,32 @@ +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") + +oci.pull( + name = "nginx", + image = "docker.io/library/nginx", + digest = "sha256:28402db69fec7c17e179ea87882667f1e054391138f77ffaf0c3eb388efc3ffb", + platforms = [ + "linux/386", + "linux/amd64", + "linux/arm/v5", + "linux/arm/v7", + "linux/arm64/v8", + "linux/mips64le", + "linux/ppc64le", + "linux/s390x" + ] +) + + +use_repo( + oci, + "nginx", + "nginx_linux_386", + "nginx_linux_amd64", + "nginx_linux_arm_v5", + "nginx_linux_arm_v7", + "nginx_linux_arm64_v8", + "nginx_linux_mips64le", + "nginx_linux_ppc64le", + "nginx_linux_s390x", +) + diff --git a/infra/containers/registry/registry.MODULE.bazel b/infra/containers/registry/registry.MODULE.bazel new file mode 100644 index 0000000..92efbd9 --- /dev/null +++ b/infra/containers/registry/registry.MODULE.bazel @@ -0,0 +1,28 @@ +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") + +oci.pull( + name = "registry", + image = "docker.io/library/registry", + digest = "sha256:ac0192b549007e22998eb74e8d8488dcfe70f1489520c3b144a6047ac5efbe90", + platforms = [ + "linux/amd64", + "linux/arm/v6", + "linux/arm/v7", + "linux/arm64/v8", + "linux/ppc64le", + "linux/s390x", + ] +) + + +use_repo( + oci, + "registry", + "registry_linux_amd64", + "registry_linux_arm_v6", + "registry_linux_arm_v7", + "registry_linux_arm64_v8", + "registry_linux_ppc64le", + "registry_linux_s390x", +) +