Speed up action container (#4035)

* Speed up action container

* fix version
This commit is contained in:
Joakim Sørensen
2024-09-04 11:31:15 +02:00
committed by GitHub
parent 0619ec93cd
commit 99bc2eee50
3 changed files with 26 additions and 3 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
*
!custom_components/hacs
!scripts
!action
!constraints.txt
!requirements_action.txt

View File

@ -1,12 +1,17 @@
FROM python:3.12-alpine
FROM python:alpine
WORKDIR /hacs
COPY . /hacs
ENV PIP_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/"
ENV \
UV_SYSTEM_PYTHON=true \
PIP_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/" \
UV_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/"
RUN \
--mount=from=ghcr.io/astral-sh/uv:0.2.27,source=/uv,target=/bin/uv \
\
apk add --no-cache --virtual .build-deps \
bash \
\
@ -21,6 +26,10 @@ RUN \
\
&& find /usr/local \( -type d -a -name test -o -name tests -o -name '__pycache__' \) -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' \; \
\
&& cp /hacs/action/action.py /hacs/action.py
&& mv /hacs/action/action.py /hacs/action.py \
\
&& rm -rf /hacs/scripts /hacs/action \
\
&& rm /hacs/requirements_action.txt /hacs/constraints.txt
ENTRYPOINT ["python3", "/hacs/action.py"]

8
scripts/install/uv_packages Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
uv pip \
install \
--constraint constraints.txt \
"${@}"