I’m working on a Python project where I need to use Bazel to manage my builds. I want to run my Python application using gunicorn as the HTTP server. I’ve already added gunicorn as a dependency in my requirements.txt file. However, I’m not sure how to configure Bazel to use gunicorn as the runner for my application. Can someone provide a clear example or guide on how to set this up?
Here is what I have so far:
requirements.txt:
flask
gunicorn
_pip_parse(
name = "embeddings_requirements",
python_interpreter_target = interpreter,
requirements_lock = "//service:requirements.txt"
)
BUILD.bazel:
load("@aspect_rules_py//py:defs.bzl", "py_binary")
py_binary(
name = name,
srcs = merged_srcs,
data = merged_data,
env = binary_env,
imports = ["src", "."],
main = main,
tags = merged_tags,
toolchains = merged_toolchains,
visibility = merged_visibility,
deps = merged_deps
)