Docker build by push
This script makes a build script with a post receive hook. You can use this to build containers when doing a git push to a remote. Basically it will run
docker build -t repo on a
git push. This is especially handy if you're working in an environment with low internet speeds. It works likes this:
- Makes a
createscript on the remote server
- With the create script you can make a new repository with a buildhook that will run the file
./bin/buildin your codebase
- It passes
$1as branch name, you can use this for deploys or performance checks.
create script on the server, this is responsible for making new repo's to which you can push.
ssh email@example.com -- 'wget https://gist.githubusercontent.com/emilebosch/f8fb129ef6028d980fc3b86c3fc1f85f/raw/cff9f5626d2dea42c0d0347cb2022404269bb39e/create && chmod +x create'
This makes a new repo, and shows you the git command to add to you current repo:
ssh firstname.lastname@example.org -- ./create [YOUR REPO NAME]
After this, do a git push!
git push build
It will start a container build and you'll be happy and free.