source/WORKSPACE

137 lines
4 KiB
Python

# WORKSPACE
#
# This file exists to configure the Bazel (https://bazel.build/) build tool to our needs.
# Particularly, it installs rule definitions and other capabilities which aren't in Bazel core.
# In the future we may have our own modifications to this config.
# Install the blessed Python and PyPi rule support
# From https://github.com/bazelbuild/rules_python
workspace(
name = "arrdem_source",
)
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
"http_file",
)
load(
"@bazel_tools//tools/build_defs/repo:git.bzl",
"git_repository",
)
####################################################################################################
# Skylib
####################################################################################################
git_repository(
name = "bazel_skylib",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
tag = "1.0.3",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
####################################################################################################
# Python support
####################################################################################################
# Using rules_python at a more recent SHA than the last release like a baws
git_repository(
name = "rules_python",
remote = "https://github.com/bazelbuild/rules_python.git",
# tag = "0.4.0",
commit = "693a1587baf055979493565933f8f40225c00c6d",
)
register_toolchains("//tools/python:python3_toolchain")
# pip package pinnings need to be initialized.
# this generates a bunch of bzl rules so that each pip dep is a bzl target
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "arrdem_source_pypi",
requirements_lock = "//tools/python:requirements_lock.txt",
python_interpreter_target = "//tools/python:pythonshim",
)
# Load the starlark macro which will define your dependencies.
load("@arrdem_source_pypi//:requirements.bzl", "install_deps")
# Call it to define repos for your requirements.
install_deps()
# git_repository(
# name = "rules_zapp",
# remote = "https://git.arrdem.com/arrdem/rules_zapp.git",
# commit = "72f82e0ace184fe862f1b19c4f71c3bc36cf335b",
# # tag = "0.1.2",
# )
local_repository(
name = "rules_zapp",
path = "/home/arrdem/Documents/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",
)