Sign inSign up

linkyard/git-sync

By linkyard

•Updated almost 8 years ago

A docker container to pull a git repository (continuously or once)

Image
0

6.0K

linkyard/git-sync repository overview

⁠docker-git-sync

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.

⁠Configuration

This docker container is configured through environment variables:

  • PKEY (optional): Path to an SSH private key used for authentication
  • REPO (required): URL of the git repository to clone
  • ONESHOT (optional): If this is set to true, clone the repository once and exit
  • SKIP_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 pull
  • BRANCH (optional): The branch to clone; defaults to master
  • INTERVAL (optional): Interval in second to check for changes. Defaults to 60.

⁠Examples

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

Tag summary

Content type

Image

Digest

Size

12.2 MB

Last updated

almost 8 years ago

docker pull linkyard/git-sync