To add external libraries for using in the python rules, these are the steps:
Modify the docker-compose.override.yml:
x-shared-libs: &shared-libs:
environment:
PYTHONPATH: /opt/libs
volumes:
- python-libs:/opt/libs
services:
api:
<<: *shared-libs
celery:
<<: *shared-libs
volumes:
python-libs:
The above code makes sure a volume is added to hold the external libraries available to the (even future) containers, being mapped into /opt/libs.
Then, you can install whatever python package by:
docker exec -u 0 celery pip install pyrad
And upon successful installation, you can use it in your code:
@rule(...)
def rule_with_pyrad(...):
import pyrad
...