I’m not in the Rasa X Team but I went through the same process as you are now ;). The Rasa blog on custom components describes the steps to take to add a component:
- add it to the
config.yml
- add the component directory the
PYTHONPATH
You need to convert those steps into a Dockerfile to build a custom container:
# Extend the official Rasa SDK image (change the version to whatever you need)
FROM rasa/rasa:1.8.2-full
# Switch to root user
USER root
# Add a folder to python path
ENV PYTHONPATH "${PYTHONPATH}:/app/my_custom_component"
# Do other stuff, e.g.: add python dependencies, etc.
# Switch back to a non-root user
USER 1001
Then:
- Build the container:
docker build . -t foobar:version
- Copy the custom components to the rasa-x installation directory
cp -r /code/dir/my_custom_component/* /etc/rasa/my_custom_component
- Add a
docker-compose.override.yml
file to/etc/rasa
and include the custom container (Note that the specific setup of the container depends on what you are trying to extend):
EDIT (fixed the docker-compose example):
services:
rasa-worker:
volumes:
- ./directory/my_custom_component.py:/app/my_custom_component.py
docker-compose
rasa-x, and you’re done!