A simple way to rebuild your web app container on every commit with local docker-compose and post-commit git hook
- Initialize your
gitrepo withgit init - Place the attached
post-commitfile into.git/hooks/directory and make it executable withchmod +x .git/hooks/post-commit - Use the attached
docker-compose.yamlandDockerfileas examples to create and run container - The
.envfile is not commited to VCS as it may contain secure configuration details. Put variables there like the following ones:APPNAME=myappAPPVERSION=latest
post-commitworking directory is the repo root, it is the same one where.gitis located- The
post-commitscript is Linux and MacOS compartible - Logs for building and running container is available in
/tmp/git-post-commitasAPPNAME-YYYYMMDD-HHMMSS-XXXfiles - Link to the Repo