tellstick-plugin-mqtt-hass icon indicating copy to clipboard operation
tellstick-plugin-mqtt-hass copied to clipboard

Add Dockerfile for building

Open janderholm opened this issue 11 months ago • 1 comments
trafficstars

Since the tellstick-server repository seem to be mostly abandoned it can no longer build plugins without downgrading some versions like pip.

I've created a Dockerfile that recreates an environment that works. I've only tried to build a zip file. Not actually installing it onto a device.

This should help solving #41 and #43.

janderholm avatar Dec 24 '24 12:12 janderholm

I've noticed I have to remove the password from the key temporarily in order for the build script to get access to it. Otherwise build will fail:

gpg --change-passphrase [email protected]

janderholm avatar Dec 27 '24 15:12 janderholm

Hi Janderholm Thank for this work. I haven't hade time until now to look at this. I have pulled in your request. Created gpg keys (RSA 4046) without password. Changed the author and atuhour_email in setup.py to correspond to the created gpg keys. Executed the commands stated in the README.md. This is the result:

`$ sudo docker build -t tellstick-plugin-mqtt-hass-build --network=host . [+] Building 1.1s (13/13) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.41kB 0.0s => [internal] load metadata for docker.io/library/ubuntu:20.04 0.9s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/9] FROM docker.io/library/ubuntu:20.04@sha256:8feb4d8ca5354def3d8fce243717141ce31e2c428701f6682b 0.0s => CACHED [2/9] RUN apt-get update && apt-get install -y build-essential curl git gpg npm python2. 0.0s => CACHED [3/9] RUN git clone --branch v1.3.2 https://github.com/telldus/tellstick-server.git /usr/src 0.0s => CACHED [4/9] RUN update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 0.0s => CACHED [5/9] WORKDIR /usr/src/tellstick-server 0.0s => CACHED [6/9] RUN echo "rsa==4.0" >> api/requirements.txt 0.0s => CACHED [7/9] RUN virtualenv --no-pip --python=python2.7 build/env 0.0s => CACHED [8/9] RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py && ./build/env 0.0s => CACHED [9/9] RUN ./tellstick.sh setup 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:38b4a28fbe1c2c7ac808753e2be40a4e655e008738305406ab7bea66bbd2fbe9 0.0s => => naming to docker.io/library/tellstick-plugin-mqtt-hass-build 0.0s

$ sudo -E ./build.sh This will bind mount /home/compad/.gnupg into a container and may mess up permissions. Do you want to continue? y Building plugin /usr/src/tellstick-server/plugins/tellstick-plugin-mqtt-hass warning: no files found matching 'epl-v10' zip_safe flag not set; analyzing archive contents... $`

It seems to build correct but key.pub in the directory package and in the zip file is zero bytes long. I would expect this to contain the public gpg key at least comparing to quazzie release zip file. And before the key.pub file is correct it is no idea contact telldus to add my key.

The warning indicates that some file or files are missing. The zip_safe=True flag can be added to setup.py which make that text disappear but the key.pub file is still zero bytes long.

Any suggestion would be greatly appreciated. /Klas

blueslow avatar Jul 04 '25 15:07 blueslow

After some more testing. It is important that the key used does not have any comment, just name and email. Also use rsa 4096 and as Janderholm wrote above no password on the private key.

On subsequent build(s) I had to remove the directory package otherwise build failed with some verification failed message.

blueslow avatar Jul 05 '25 15:07 blueslow