docker compose build sibling container
hey there, interesting project. I was looking for a solution exactly like this but with an additional use cases. running the listener inside a docker container, part of the same docker-compose file, a sibling container (nginx) needs to be rebuilt on a trigger.
with local install I guess it should be possible since I'd execute a bash script with the rebuild but do you have any ideas how to do it from within a container->host?
Not sure what you're trying to do, but in my setup I'm triggering an Nginx restart by doing this from inside my Docker's listener:
touch /var/run/vm-reload/vm-reload-nginx-config
Then I have this script set up in cron.d on the host:
#!/usr/bin/env bash
set -e
NGINX_RELOAD_FILE="/var/run/vm-reload/vm-reload-nginx-config"
if [ ! -d /var/run/vm-reload ]; then
mkdir -p /var/run/vm-reload
chown -R root:docker /var/run/vm-reload
chmod -R ug+rw /var/run/vm-reload
fi
if [ -f "$NGINX_RELOAD_FILE" ]; then
echo "------------------------------"
echo "Reloading Nginx configuration"
date
echo
rm "$NGINX_RELOAD_FILE"
/usr/sbin/service nginx configtest && /usr/sbin/service nginx reload
fi
And then in /etc/cron.d/my-stuff:
*/1 * * * * root /path/to/maybe-restart-services
So it's set to run every minute. This way I can push Nginx config changes via a git push.