Created
April 19, 2022 15:31
-
-
Save ewhauser/3c6eaaec507e96e068cc6633a3ec135a to your computer and use it in GitHub Desktop.
Bazel + Gunicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gunicorn.app.wsgiapp import run | |
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunicorn_binary( | |
name = "hello", | |
args = ["hello:app"], | |
deps = [ | |
"@pypi_flask//:pkg", | |
], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("@rules_python//python:defs.bzl", "py_binary", "py_library") | |
def gunicorn_binary(name, deps = [], **kwargs): | |
py_library( | |
name = name + "_lib", | |
srcs = [name + ".py"], | |
deps = deps, | |
) | |
args = kwargs.pop("args", [name + ":app"]) | |
py_binary( | |
name = name, | |
srcs = ["//python/wrappers/gunicorn:__main__.py"], | |
main = "//python/wrappers/gunicorn:__main__.py", | |
deps = [ | |
"@pypi_gunicorn//:pkg", | |
":" + name + "_lib", | |
], | |
args = args, | |
**kwargs | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment