From 4faa29c124a599a88b723d017c04e7d4f38d5909 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sat, 19 Nov 2022 23:54:45 -0700 Subject: [PATCH] Update some of the build infra --- WORKSPACE | 72 ++++++++++++++++++++++++++++++--- tools/build_rules/prelude_bazel | 7 ++++ tools/python/defs.bzl | 2 + 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index fad71a2..1cbea3a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -41,7 +41,7 @@ git_repository( name = "rules_python", remote = "https://github.com/bazelbuild/rules_python.git", # tag = "0.4.0", - commit = "888fa20176cdcaebb33f968dc7a8112fb678731d", + commit = "f0efec5cf8c0ae16483ee677a09ec70737a01bf5", ) register_toolchains("//tools/python:python3_toolchain") @@ -63,13 +63,75 @@ load("@arrdem_source_pypi//:requirements.bzl", "install_deps") install_deps() git_repository( - name = "rules_zapp", - remote = "https://github.com/arrdem/rules_zapp.git", - commit = "d7a0382927fb8a68115b560f4fee7dca743068f8", - # tag = "0.1.2", + name = "rules_zapp", + remote = "https://git.arrdem.com/arrdem/rules_zapp.git", + commit = "c11c64f557410ec21a2a717381928670a244d21d", + # tag = "0.1.2", ) # local_repository( # name = "rules_zapp", # path = "/home/arrdem/doc/hobby/programming/lang/python/rules_zapp", # ) + +#################################################################################################### +# Docker support +#################################################################################################### + +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"], +) + +load("@io_bazel_rules_docker//toolchains/docker:toolchain.bzl", + docker_toolchain_configure="toolchain_configure" +) + +docker_toolchain_configure( + name = "docker_config", + docker_flags = [ + ], +) + +load( + "@io_bazel_rules_docker//repositories:repositories.bzl", + container_repositories = "repositories", +) +container_repositories() + +load( + "@io_bazel_rules_docker//repositories:deps.bzl", + container_deps = "deps" +) + +container_deps() + +load( + "@io_bazel_rules_docker//container:container.bzl", + "container_pull", +) + +# container_pull( +# name = "python_base", +# registry = "index.docker.io", +# repository = "library/python", +# tag = "3.10.8-alpine" +# # sha256 = "digest:d78a749034380426dd6cec6a0db139459ca701630533ffce112adbcdd996fddd", +# ) + +# container_pull( +# name = "python_base", +# registry = "gcr.io", +# repository = "distroless/python3-debian11", +# tag = "latest" +# # sha256 = "digest:d78a749034380426dd6cec6a0db139459ca701630533ffce112adbcdd996fddd", +# ) + +container_pull( + name = "python_base", + registry = "index.docker.io", + repository = "library/python", + tag = "3.11-buster" + # sha256 = "digest:d78a749034380426dd6cec6a0db139459ca701630533ffce112adbcdd996fddd", +) diff --git a/tools/build_rules/prelude_bazel b/tools/build_rules/prelude_bazel index 5a600f2..164e07e 100644 --- a/tools/build_rules/prelude_bazel +++ b/tools/build_rules/prelude_bazel @@ -30,3 +30,10 @@ load("//tools/build_rules:webp.bzl", load("@rules_zapp//zapp:zapp.bzl", "zapp_binary", ) + +load( + "@io_bazel_rules_docker//container:container.bzl", + "container_image", + "container_bundle", + "container_push", +) diff --git a/tools/python/defs.bzl b/tools/python/defs.bzl index c902c4b..dade4f0 100644 --- a/tools/python/defs.bzl +++ b/tools/python/defs.bzl @@ -158,6 +158,7 @@ py_resources = rule( def py_project(name=None, main=None, main_deps=None, + shebang=None, lib_srcs=None, lib_deps=None, lib_data=None, @@ -238,6 +239,7 @@ def py_project(name=None, visibility = [ "//visibility:public", ], + shebang = shebang, ) for src in test_srcs: