How to extend the dependencies of code blocks
Standalone Mode
Dependency Library Persistence
The following operations must be performed while the service is running and need to be done only once during the first setup. Subsequent installation of extension libraries does not require this operation.
-
Create a directory to mount the dependency libraries (the actual directory can be customized), such as:
mkdir -p /data/mingdao/script/volume/command/package/python-3.6/mkdir -p /data/mingdao/script/volume/command/package/nodejs-10.18.0/ -
Retrieve pre-installed dependency libraries:
docker cp $(docker ps | grep command | awk '{print $1}'):/usr/local/lib/python3.6/site-packages/ /data/mingdao/script/volume/command/package/python-3.6/docker cp $(docker ps | grep command | awk '{print $1}'):/usr/local/node-10.18.0/lib/node_modules/ /data/mingdao/script/volume/command/package/nodejs-10.18.0/ -
Modify
docker-compose.yamlto mount the dependency library directories from the host to the container:services:command:volumes:- ./volume/command/package/python-3.6/site-packages/:/usr/local/lib/python3.6/site-packages/- ./volume/command/package/nodejs-10.18.0/node_modules/:/usr/local/node-10.18.0/lib/node_modules/ -
Execute the following command in the root directory of the manager to restart the service:
bash ./service.sh restartall
Installing Extension Libraries Online
Reminder
- Ensure the "Dependency Library Persistence" step is completed first. The container's dependency library directory must be persistently mounted to the host. Otherwise, extension libraries will need to be reinstalled after the container restarts.
- Ensure the server has internet access for online installation of extension libraries.