Use uv instead of pip in Supervisor (#5152)

* Migrate supervisor image from pip to uv

* Set python paths

* Put in i386 conditional to match core

* Semicolons within if statements
This commit is contained in:
Mike Degatano 2024-07-03 11:51:16 -04:00 committed by GitHub
parent 1a1ee50d9d
commit 02bdc4b555
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 11 deletions

View File

@ -5,7 +5,8 @@
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
}, },
"appPort": ["9123:8123", "7357:4357"], "appPort": ["9123:8123", "7357:4357"],
"postCreateCommand": "bash devcontainer_bootstrap", "postCreateCommand": "bash devcontainer_setup",
"postStartCommand": "bash devcontainer_bootstrap",
"runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"], "runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"],
"customizations": { "customizations": {
"vscode": { "vscode": {
@ -19,17 +20,21 @@
"GitHub.vscode-pull-request-github" "GitHub.vscode-pull-request-github"
], ],
"settings": { "settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.pythonPath": "/usr/local/bin/python",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.testing.pytestArgs": ["--no-cov"],
"pylint.importStrategy": "fromEnvironment",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": { "terminal.integrated.profiles.linux": {
"zsh": { "zsh": {
"path": "/usr/bin/zsh" "path": "/usr/bin/zsh"
} }
}, },
"terminal.integrated.defaultProfile.linux": "zsh", "terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"python.pythonPath": "/usr/local/bin/python3",
"[python]": { "[python]": {
"editor.defaultFormatter": "charliermarsh.ruff" "editor.defaultFormatter": "charliermarsh.ruff"
} }

View File

@ -4,7 +4,8 @@ FROM ${BUILD_FROM}
ENV \ ENV \
S6_SERVICES_GRACETIME=10000 \ S6_SERVICES_GRACETIME=10000 \
SUPERVISOR_API=http://localhost \ SUPERVISOR_API=http://localhost \
CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1 CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1 \
UV_SYSTEM_PYTHON=true
ARG \ ARG \
COSIGN_VERSION \ COSIGN_VERSION \
@ -26,14 +27,17 @@ RUN \
yaml \ yaml \
\ \
&& curl -Lso /usr/bin/cosign "https://github.com/home-assistant/cosign/releases/download/${COSIGN_VERSION}/cosign_${BUILD_ARCH}" \ && curl -Lso /usr/bin/cosign "https://github.com/home-assistant/cosign/releases/download/${COSIGN_VERSION}/cosign_${BUILD_ARCH}" \
&& chmod a+x /usr/bin/cosign && chmod a+x /usr/bin/cosign \
&& pip3 install uv==0.2.21
# Install requirements # Install requirements
COPY requirements.txt . COPY requirements.txt .
RUN \ RUN \
export MAKEFLAGS="-j$(nproc)" \ if [ "${BUILD_ARCH}" = "i386" ]; then \
&& pip3 install --only-binary=:all: \ linux32 uv pip install --no-build -r requirements.txt; \
-r ./requirements.txt \ else \
uv pip install --no-build -r requirements.txt; \
fi \
&& rm -f requirements.txt && rm -f requirements.txt
# Install Home Assistant Supervisor # Install Home Assistant Supervisor