from invoke import task @task def serve(c): """Serves the speech-collect application locally.""" c.run("LITESTAR_APP=speech_collect.app:app litestar run --port 8888 --host 0.0.0.0 --reload") @task def build_image(c, dev=True): """Builds the speech-collect container image.""" context_dir = c.run("pwd", hide=True).stdout.strip() commit_sha = c.run("git rev-parse --short HEAD", hide=True).stdout.strip() c.run( f"docker build --build-arg='COMMIT_SHA={commit_sha}' -t speech-collect:{commit_sha}{'-dev' if dev else ''} {context_dir}" ) @task def delint(c): """Applies automated linters to project""" c.run("isort ./speech_collect ./tests", pty=True) c.run("black ./speech_collect ./tests", pty=True)