Many times is necessary to run some command after the BlueXolo container starts, example; test new feature that needs to run after container starts, modify BlueXolo behavior to launch some task(s) after start container, etc.
By now the unique alternative to get this, is modify the rc.local file. This file is stored in docker/scripts/rc.local. This script run when container start, and because this script is attached to BlueXolo docker image even if the rc.local is modified and stored in the volume "/opt/BlueXolo-src" the changes will be not applied, the reason is because the docker image is built with different version of rc.local
That means that if you want to add a new task on-start process is necessary to modify the rc.local, and also rebuild the docker image, making this, the new docker image will have the new version of the rc.local that the developer has just wrote in rc.local
As we can figure, this could turn into a hardly task because even modify the rc.local to add the most simple task on-start will force to the developer to rebuild a new image, and most important. The docker image that is stored in docker hub will be hardly to keep up to date.
The solution to avoid many rebuild of the image during the dev process consists in next steps:
under directory docker/scripts create a new script called user-startup-tasks.sh
add next lines in the end of the file rc.local
USER_STARTUP_TASKS_FILE=docker/scripts/user-startup-tasks.sh
if [ -f "$USER_STARTUP_TASKS_FILE" ]; then
chmod + docker/scripts/user-startup-tasks.sh
./docker/scripts/user-startup-tasks.sh
fi
rebuild a new bluexolo docker image. This new docker image must contains the changes in file rc.local
upload the new bluexolo docker image to docker hub
With this changes if any other developer needs to performance some task(s) after docker container has started, the developer will needs to make changes in file user-startup-tasks.sh, then ensure that this file is stored in the directory that is used by the volume "/opt/BlueXolo-src", and finally restart the container. As we can see it won't be neccessary to rebuild bluexolo docker image every time when some task on start needs to be performed
Many times is necessary to run some command after the BlueXolo container starts, example; test new feature that needs to run after container starts, modify BlueXolo behavior to launch some task(s) after start container, etc.
By now the unique alternative to get this, is modify the rc.local file. This file is stored in docker/scripts/rc.local. This script run when container start, and because this script is attached to BlueXolo docker image even if the rc.local is modified and stored in the volume "/opt/BlueXolo-src" the changes will be not applied, the reason is because the docker image is built with different version of rc.local
That means that if you want to add a new task on-start process is necessary to modify the rc.local, and also rebuild the docker image, making this, the new docker image will have the new version of the rc.local that the developer has just wrote in rc.local
As we can figure, this could turn into a hardly task because even modify the rc.local to add the most simple task on-start will force to the developer to rebuild a new image, and most important. The docker image that is stored in docker hub will be hardly to keep up to date.
The solution to avoid many rebuild of the image during the dev process consists in next steps:
With this changes if any other developer needs to performance some task(s) after docker container has started, the developer will needs to make changes in file user-startup-tasks.sh, then ensure that this file is stored in the directory that is used by the volume "/opt/BlueXolo-src", and finally restart the container. As we can see it won't be neccessary to rebuild bluexolo docker image every time when some task on start needs to be performed