I’m trying to get the following working:
- My server(s) listen for a git commit to a specific branch (dev and prod).
- Server then pulls the latest and executes a shell script “sudo update.sh”
- sudo update.sh: will stop all docker containers/services and delete them, it will also delete any images. It will then re-build and re-start the swarm.
Step 1: I find various information from long ago online on how to do this but nothing that explains the linking of this or how to set it up. Or its telling me to go into menus that just don’t exist on github. Should I switch to gitlab? There will be many servers litening to the repo and some will be prod and 2 or 3 will be dev. I’ve watched lots of videos on people building scripts on github and its doing tests and etc etc but where is it building this, how do i build on the actual servers? I don’t get the link between server and github, is this just for image docker image build and then server to monitor the new image save to docker and to update?
Step 2: No idea, can’t get step 1 working.
Step 3: Not a problem just write a bash script, getting git or whatever step 1 and 2 is handled by no idea.
I don’t care about unit tests, I just need to auto pull and re-build on branch commit.
Anyone got any tips? guide / tutorial links? YouTube walkthroughs for such a process?
Should I write some python or node server, listen for hook calls and get python/node to handle the git pull and execution of the bash script?