A docker container to pull a git repository (continuously or once)
6.0K
A docker container that pulls a git repository, either continuously or just once.
The docker container pulls the git repository to the directory /data, you need to
mount this as a volume through docker or an orchestrator like kubernetes.
If you want to execute arbitrary commands when changes to the git repository are
detected, place shell-scripts into the folder /update-hooks by mounting a volume
with those scripts into the container.
This docker container is configured through environment variables:
PKEY (optional): Path to an SSH private key used for authenticationREPO (required): URL of the git repository to cloneONESHOT (optional): If this is set to true, clone the repository once and exitSKIP_CLONE (optional): If this is set to true, git clone is skipped, assuming that the
directory /data already contains the cloned git repository; the directory is only checked
for updates with git fetch and git pullBRANCH (optional): The branch to clone; defaults to masterINTERVAL (optional): Interval in second to check for changes. Defaults to 60.To pull a repository [email protected]:linkyard/docker-git-sync.git once with a private key
that is stored locally in the file /path/to/private-key/id_rsa and pull the repository
to a folder /path/to/data:
docker run \
--rm \
-e PKEY=/var/run/private-key/id_rsa \
-v /path/to/private-key/:/var/run/private-key/:ro \
-e [email protected]:linkyard/docker-git-sync.git \
-e ONESHOT=true \
-v /path/to/data:/data \
linkyard/git-sync
To check for changes every two minutes and use the mybranch branch:
docker run \
--rm \
-e PKEY=/var/run/private-key/id_rsa \
-v /path/to/private-key/:/var/run/private-key/:ro \
-e [email protected]:linkyard/docker-git-sync.git \
-e INTERVAL=120 \
-e BRANCH=mybranch \
-v /path/to/data:/data \
linkyard/git-sync
Content type
Image
Digest
Size
12.2 MB
Last updated
almost 8 years ago
docker pull linkyard/git-sync