Use the python version from .pyton-version file for hassfest image (#168368)

This commit is contained in:
Robert Resch
2026-04-17 08:02:49 +02:00
committed by GitHub
parent dfa911b2b3
commit 67458786a3
2 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -127,7 +127,7 @@ def _generate_machine_dockerfile(
_HASSFEST_TEMPLATE = r"""# Automatically generated by hassfest.
#
# To update, run python3 -m script.hassfest -p docker
FROM python:3.14-alpine
FROM python:{python_version}-alpine
ENV \
UV_SYSTEM_PYTHON=true \
@@ -166,6 +166,11 @@ LABEL "com.github.actions.color"="gray-dark"
"""
def _get_python_version(root: Path) -> str:
"""Extract the Python version from .python-version."""
return (root / ".python-version").read_text(encoding="UTF-8").strip()
@dataclass
class File:
"""File."""
@@ -194,7 +199,9 @@ def _generate_files(config: Config) -> list[File]:
config.root / "Dockerfile",
),
File(
_HASSFEST_TEMPLATE.format(),
_HASSFEST_TEMPLATE.format(
python_version=_get_python_version(config.root),
),
config.root / "script/hassfest/docker/Dockerfile",
),
]
+1 -1
View File
@@ -1,7 +1,7 @@
# Automatically generated by hassfest.
#
# To update, run python3 -m script.hassfest -p docker
FROM python:3.14-alpine
FROM python:3.14.2-alpine
ENV \
UV_SYSTEM_PYTHON=true \