2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Docker fix ()

* Fix server command in Dockerfile

* Ensure invoke is installed into the venv

* Run extra check in docker build step

* Improve documentation

* Intercept ModuleNotFoundError

- Clear error message

* Docs updates

* Add extra check to dev docker build

* Cleanup tasks.py

* Prevent double activation of venv

* Change order of operations

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
Oliver
2025-01-06 09:46:16 +11:00
committed by GitHub
parent 6b5e0dbb29
commit 0614f01247
9 changed files with 77 additions and 10 deletions

@ -15,6 +15,29 @@ from invoke import Collection, task
from invoke.exceptions import UnexpectedExit
def task_exception_handler(t, v, tb):
"""Handle exceptions raised by tasks.
The intent here is to provide more 'useful' error messages when tasks fail.
"""
sys.__excepthook__(t, v, tb)
if t is ModuleNotFoundError:
mod_name = str(v).split(' ')[-1].strip("'")
error(f'Error importing required module: {mod_name}')
warning('- Ensure the correct Python virtual environment is active')
warning(
'- Ensure that the invoke tool is installed in the active Python environment'
)
warning(
"- Ensure all required packages are installed by running 'invoke install'"
)
sys.excepthook = task_exception_handler
def success(*args):
"""Print a success message to the console."""
msg = ' '.join(map(str, args))