Update local git repositories and execute an "on-update command".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bit b6efb90ab9 repos is not always persistent 5 months ago
Dockerfile repos is not always persistent 5 months ago
README.md Update 'README.md' 5 months ago
cmd.py completely rewritten to remove the dependency on dulwich 5 months ago
connections.py completely rewritten to remove the dependency on dulwich 5 months ago
entrypoint fixed errors in entrypoint 5 months ago
file.py completely rewritten to remove the dependency on dulwich 5 months ago
start.py fix 'adding repo if not loaded' 5 months ago

README.md

GitUpdateService

A python service to automatically update a local git repository and execute a command on an update.

Repositories can be accessed via http/s or ssh. When using http/s one can give an username and a password to login. When using ssh a private key is required. Add the private key as a volume or as a secret [recommended] (requires at least docker-compose version 3.1). Configuration can be done via config.json to update multiple repositories or via environment variables if only one repository is updated.

An example is:

version: "3.1"

services:
    git_update_service:
        image: git_update_service:latest
        build: https://git.darknebu.la/bit/GitUpdateService.git
        environment:
            - "ON_UPDATE=echo 'The GitUpdateService got an updated.'"
            - "REMOTE_HTTP_URL=https://git.darknebu.la/bit/GitUpdateService.git"
        secrets:
            - source: ssh_key
              target: /id_rsa
        volumes:
            - ./repo:/repos
        restart: unless-stopped

secrets:
    ssh_key:
      file: /path/to/my/key/id_rsa

There are several environment variables that can be set:

ENVIRONMENT VARIABLE Default Description
ON_UPDATE A command that is executed when an update was made
INTERVAL 60 The time interval in seconds how often the service checks for an update
LOCAL /repos The container internal path to the local repository
REMOTE_BRANCH master The remote branch that is updated / cloned
REMOTE_TYPE http The connection type (http or ssh)
REMOTE_HTTP_URL The http/s git repository url
REMOTE_HTTP_USERNAME The git username
REMOTE_HTTP_PASSWORD The git users password
REMOTE_SSH_HOST The ssh git repository url
REMOTE_SSH_KEY_FILE /id_rsa The container internal path to the private key (not just rsa)