diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 108019cad02..e81bbf47de1 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -54,7 +54,8 @@ jobs: - name: Build and push uses: docker/build-push-action@v5.3.0 with: - context: ./action + context: . + file: action/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8beff52ca85..2e99666febe 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -81,8 +81,7 @@ jobs: - name: Build Container run: | - cd action - docker build . -t hacs/action:local + docker build . -t hacs/action:local -f action/Dockerfile - name: Run Action run: | diff --git a/action/Dockerfile b/action/Dockerfile index aac8eba85c6..0a482382a91 100644 --- a/action/Dockerfile +++ b/action/Dockerfile @@ -1,22 +1,17 @@ -FROM python:3.11-alpine +FROM python:3.12-alpine WORKDIR /hacs +COPY . /hacs + +ENV PIP_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/" + RUN \ - apk add --no-cache \ - libffi-dev \ - \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bash \ - gcc \ - git \ - musl-dev \ - \ - && git clone --quiet --depth 1 https://github.com/hacs/integration.git /hacs \ \ - && bash /hacs/scripts/install/pip_packages setuptools wheel \ - \ - && bash /hacs/scripts/install/pip_packages homeassistant aiogithubapi async-timeout \ + && bash /hacs/scripts/install/pip_packages \ + -r requirements_action.txt \ \ && bash /hacs/scripts/install/frontend \ \ @@ -24,8 +19,8 @@ RUN \ \ && rm -rf /var/cache/apk/* \ \ - && 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 '{}' \; - -COPY ./action.py /hacs/action.py + && 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 -ENTRYPOINT ["python3", "/hacs/action.py"] \ No newline at end of file +ENTRYPOINT ["python3", "/hacs/action.py"] diff --git a/requirements_action.txt b/requirements_action.txt new file mode 100644 index 00000000000..1dff183b2a5 --- /dev/null +++ b/requirements_action.txt @@ -0,0 +1,3 @@ +aiogithubapi>=21.11.0 +async-timeout>=4.0.3 +homeassistant==2024.3.3