Skip to content

Commit

Permalink
Update action Dockerfile (#3624)
Browse files Browse the repository at this point in the history
* Update dockerfile used in action

* Remove git

* lint

* Add missing copy

* Remove more things from the image
  • Loading branch information
ludeeus authored May 2, 2024
1 parent 2e85dcc commit f2bdb2b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/action-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
- name: Build and push
uses: docker/[email protected]
with:
context: ./action
context: .
file: action/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 1 addition & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
29 changes: 12 additions & 17 deletions action/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
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 \
\
&& apk del --no-cache .build-deps > /dev/null 2>&1 \
\
&& 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"]
ENTRYPOINT ["python3", "/hacs/action.py"]
3 changes: 3 additions & 0 deletions requirements_action.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
aiogithubapi>=21.11.0
async-timeout>=4.0.3
homeassistant==2024.3.3

0 comments on commit f2bdb2b

Please sign in to comment.