Using custom python libs in a docker with appdaemon?

Since I got a new server I’m starting over in containers. I have everything worked except my text messages app which uses Twilio because it requires the twilio pip package. If I’m using the base appdaemon docker image what’s the best(easiest) way to include a python module?

The “docker way” is to build a new image with a docker file based on the official appdaemon image, and include the needed libraries in the new image.

I have done something similar for another completely unrelated project here, which should give you an idea of what would be needed.

Alternatively, I think it would be possible to write some python to download some modules, but its not something I’ve looked in to.

Hello @ryanrdetzel,

If you look at the appdaemon docker docs here https://github.com/hassio-addons/addon-appdaemon3/tree/v1.4.1, you will see under configuration the ability to specify python packages that will be installed as python_packages. I don’t use docker, but I believe others have achieved it that way.

Regards

I read up on docker-compose and the easiest way was to use a Dockerfile and build it. I think this is best because it still uses the main image so I can upgrade and it added very little to the process. If there is a better (proven) way please let me know though.

Here is my compose. It’s building a local Dockerfile in appdaemon-custom

docker-compose.yaml

appdaemon:
  build: appdaemon-custom
  container_name: appdaemon-custom
  restart: always
  network_mode: bridge
  ports:
    - 5050:5050
  volumes:
    - /home/ryan/homeassistant-appdaemon-config:/conf
  environment:
    - HA_URL="http://192.168.1.201:8123"
    - DASH_URL="http://192.168.1.201:5050"

Dockerfile

FROM acockburn/appdaemon:latest
RUN pip3 install Twilio
EXPOSE 5050
1 Like