Packaging
Extraction plugins are packaged as OCI images (also known as Docker images).
The OCI images are labeled with the PluginInfo.
To automate packaging of a Python plugin and labeling the OCI image,
the Extraction Plugin SDK comes with a utility application build_plugin.
Make sure that the Extraction Plugins SDK is installed as well as Docker.
Then, build your plugin container image using the following command:
build_plugin PLUGIN_FILE DOCKER_FILE_DIRECTORY [DOCKER_IMAGE_NAME] [DOCKER_ARGS]
For example:
build_plugin chatplugin.py . chatplugin --build-arg http_proxy="$http_proxy" --build-arg https_proxy="$https_proxy"
This will generate a plugin image:
The extraction plugin is added to your local image registry (
docker images),Note that the variables
$http_proxyand$https_proxyare put in quotes, this is needed in case they contain spaces,The image is tagged with two tags:
latest, and your plugin version.
Arguments:
PLUGIN_FILE: Path to the python file of the plugin.
DOCKER_FILE_DIRECTORY: Path to the directory containing the Dockerfile of the plugin.
(Optional) [DOCKER_IMAGE_NAME]: Name of the docker image without tag. Note that docker image names cannot start with a period or dash. If it starts with a dash, it will be interpreted as an additional docker argument (see DOCKER_ARGS). If no name is given the name defaults to
extraction-plugin/PLUGINID, e.g.extraction-plugin/nfi.nl/extract/chat/whatsapp.(Optional) [DOCKER_ARGS]: Additional arguments for the docker command, which can be as many arguments as you like.
To verify that the image has been built, type the following command to view all local images:
docker images
Once your plugin is packaged, it can be published or ‘uploaded’ to Hansken. See “Upload the plugin to Hansken” for instructions.