11e49bac7fa1e17235ad813db427ac555d6ff36d
docker-git-puller
A docker container that pulls a git repo (updates it) every given amount of time (default 60s) with a shell script.
Purpose
There are many scenarios where such a container could help. For example (as I use it), this image could be used to pull a hugo built website (living in a public git repo) to a local folder, so that another docker container can serve the most recent files.
See the docker-compose example for a quick overview how this works.
Building
Building this docker image is quite easy. For a quick start, just use this:
docker build -t git-puller .
After this is done successfully, you can check out the new image in your local image store with docker images.
Configuration
Essentially, this image can be configured over environment variables.
PULL_LOCATION: used to set the container-internal folder which is getting pulled frequently (you should mount one into this direction) - defaults to/to-pullPULL_INTERVAL: the interval between pulls in seconds (minimum is 5, default is 60)PULLER_UID: the uid of the user that executes thegit pullcommand (defaults to 1000)GIT_OUTPUT: if set to 0, thegit pullstdout will be hidden from docker logs (redirected to /dev/null ;) (if not set, everything is visible in the docker logs)
Useful links
Similar projects:
- https://github.com/abes-esr/gitpuller-docker/
- https://github.com/Ekito/docker-cron/
- https://github.com/keckelt/cron-alpine/
- https://github.com/theohbrothers/docker-alpine-cron/
Forum posts:
- https://serverfault.com/questions/599103/make-a-docker-application-write-to-stdout
- https://stackoverflow.com/questions/71557316/docker-alpine-execute-command-as-another-user
License
see LICENSE.md
Languages
Shell
93.6%
Dockerfile
6.4%