Maintenance: local documentation raises exception when run in docker #3073
Description
opened on Sep 16, 2024
Summary
When running the documentation locally using Docker the mkdocs serve
command seems to fail
Running docker run --rm -it -p 8000:8000 -v ${PWD}:/docs powertools-typescript/docs
, causes this exception:
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/__main__.py", line 268, in serve_command
serve.serve(**kwargs)
File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 54, in serve
config = get_config()
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 43, in get_config
config = load_config(
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/config/base.py", line 374, in load_config
errors, warnings = cfg.validate()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/config/base.py", line 231, in validate
run_failed, run_warnings = self._validate()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/config/base.py", line 188, in _validate
self[key] = config_option.validate(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/config/base.py", line 55, in validate
return self.run_validation(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/config/config_options.py", line 868, in run_validation
return theme.Theme(**theme_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/theme.py", line 61, in __init__
self._load_theme_config(name)
File "/usr/local/lib/python3.11/site-packages/mkdocs/theme.py", line 126, in _load_theme_config
theme_dir = utils.get_theme_dir(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/utils/__init__.py", line 259, in get_theme_dir
return os.path.dirname(os.path.abspath(theme.load().__file__))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen posixpath>", line 399, in abspath
TypeError: expected str, bytes or os.PathLike object, not NoneType
FATA[0000] exit status 1
The issue seem to have been introduced in this PR and only occurs when using Docker. If I run the docs using Python directly on my machine I am able to run it normally.
Likewise, the build for the docs is also unaffected.
We should investigate why this is happening.
Why is this needed?
So that contributors in this repo can run the docs locally without having to install Python on their machines.
Which area does this relate to?
Other
Solution
No response
Acknowledgment
- This request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Assignees
Labels
Type
Projects
Status
Shipped
Activity