diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index f812f75..0fc5340 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -54,6 +54,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PAT: ${{secrets.PAT}} REPOSITORY_TRIVY_DISABLE_ERRORS: true + DOCKERFILE_HADOLINT_DISABLE_ERRORS: true # Upload Mega-Linter artifacts. # They will be available on Github action page "Artifacts" section diff --git a/Dockerfile b/Dockerfile index b3d7036..21cf6d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,12 @@ -FROM python:3.10 +FROM python:slim ARG application_version LABEL maintainer="Joe Block " LABEL description="ha-mqtt-discoverable utility image" LABEL version=${application_version} -RUN apt-get update && \ - apt-get install --no-install-recommends -y apt-utils=2.2.4 ca-certificates=20210119 && \ - update-ca-certificates && \ - rm -fr /tmp/* /var/lib/apt/lists/* - -# Copy wheel file built by Poetry -COPY dist/*.whl /app/ - -RUN python -m pip install --upgrade pip --no-cache-dir && \ - pip install --no-cache-dir /app/*.whl && \ - pip cache purge && \ - rm -rf /app/*.whl +RUN python -m pip install ha-mqtt-discoverable && \ + pip cache purge USER nobody diff --git a/Makefile b/Makefile index be38e61..f695796 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' # If this pukes trying to import paho, try running 'poetry install' -MODULE_VERSION=$(shell poetry run python3 -c 'from ha_mqtt_discoverable import __version__;print(__version__)' ) +MODULE_VERSION=$(shell grep vers pyproject.toml | cut -d= -f2 | sed s/\"//g) clean: ## Cleans out stale wheels, generated tar files, .pyc and .pyo files rm -fv dist/*.tar dist/*.whl @@ -40,8 +40,10 @@ trial: wheel docker buildx build --no-cache --build-arg application_version=${MODULE_VERSION} --load -t unixorn/ha-mqtt-discoverable:$(MODULE_VERSION) . multiarch_image: wheel ## Makes a multi-architecture docker image for linux/arm64, linux/amd64 and linux/arm/v7 and pushes it to dockerhub - docker buildx build --no-cache --build-arg application_version=${MODULE_VERSION} --platform linux/arm64,linux/amd64,linux/arm/v7 --push -t unixorn/ha-mqtt-discoverable:$(MODULE_VERSION) . - make local + docker buildx build --no-cache --build-arg application_version=${MODULE_VERSION} --platform linux/arm64,linux/amd64,linux/arm/v7 --push -t unixorn/ha-mqtt-discoverable . + docker buildx build --build-arg application_version=${MODULE_VERSION} --platform linux/arm64,linux/amd64,linux/arm/v7 --push -t unixorn/ha-mqtt-discoverable:$(MODULE_VERSION) . + docker pull unixorn/ha-mqtt-discoverable + docker pull unixorn/ha-mqtt-discoverable:$(MODULE_VERSION) wheel: clean format ## Builds a wheel for our modules. 'poetry' bakes the dependencies into the wheel metadata. poetry build