commit 600c2c3c644631103007ef7577a4bc1279e62d03 Author: Tamás Gérczei Date: Wed Jan 13 21:10:29 2021 +0100 working prototype diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..795da6d --- /dev/null +++ b/Containerfile @@ -0,0 +1,41 @@ +FROM python:3.7-alpine AS builder +RUN apk --update --no-cache add build-base && \ + python -m pip install --cache-dir=/tmp/ \ + click==7.1.2 \ + CoAPthon3==1.0.1 \ + Flask==1.1.2 \ + itsdangerous==1.1.0 \ + Jinja2==2.11.2 \ + MarkupSafe==1.1.1 \ + prometheus-client==0.9.0 \ + py-air-control==2.2.0 \ + py-air-control-exporter==0.3.0 \ + pycryptodomex==3.9.9 \ + Werkzeug==1.0.1 && \ + mkdir /wheels/ && \ + find /tmp/wheels -type f -name '*.whl' | xargs -I{} cp -v {} /wheels/ + +FROM python:3.7-alpine +COPY --from=builder /wheels /packages + +RUN python -m pip install --no-cache-dir --no-index --find-links=packages/ \ + CoAPthon3==1.0.1 \ + MarkupSafe==1.1.1 \ + pycryptodomex==3.9.9 && \ + python -m pip install --no-cache-dir \ + click==7.1.2 \ + Werkzeug==1.0.1 \ + Jinja2==2.11.2 \ + Flask==1.1.2 \ + itsdangerous==1.1.0 \ + py-air-control==2.2.0 \ + py-air-control-exporter==0.3.0 && \ + rm -rf /packages && \ + adduser -s /bin/false -S -D python + +EXPOSE 9896 +USER python +WORKDIR /home/python +ENTRYPOINT ["py-air-control-exporter"] +CMD ["--host", "0.0.0.0"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..98c14f4 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# contain-air +## What? +Exports Prometheus metrics from Philips smart air purifiers ("i" series). +## How? +Using the GitHub project [urbas/py-air-control-exporter](https://github.com/urbas/py-air-control-exporter). + +### Usage example +docker run -d --log-driver none -P --name air-purifier-monitoring --memory=50m --restart on-failure tgerczei/py-air-control-exporter --host ip.address.of.purifier --protocol coap