Sign inSign up

giraffacarp/gitsync

By giraffacarp

•Updated over 1 year ago

lightweight git synchronisation

Image
Integration & delivery
0

746

giraffacarp/gitsync repository overview

⁠Git Sync Container

A Docker image that continuously synchronizes a Git repository subtree to a destination path using Go Task.

⁠Prerequisites

  • Docker installed
  • SSH key configured for Git repository access

⁠Quick Start

docker run -d \
  -e GIT_REPO_URL="[email protected]:your/repo.git" \
  -e GIT_SUBFOLDER_PATH="src" \
  -v $HOME/.ssh:/ssh:ro \
  -v /host/path/to/sync/to:/sync \
  giraffacarp/gitsync

⁠Docker Compose Example

services:
  gitsync:
    image: giraffacarp/gitsync
    environment:
      GIT_REPO_URL: "[email protected]:your/repo.git"
      GIT_SUBFOLDER_PATH: "src"
      SYNC_INTERVAL: 30
    volumes:
      - data-sync:/sync
      - $HOME/.ssh:/ssh:ro

volumes:
  data-sync

⁠SSH Options

  1. Mount entire SSH dir
    -v $HOME/.ssh:/ssh:ro
    
  2. Mount single key
    -v $HOME/.ssh/id_rsa:/ssh/id_git:ro
    
  3. Set key as environment variable
    -e GIT_SECRET_KEY="$(cat $HOME/.ssh/id_rse | base64)"
    

Note

Always mount SSH keys as read-only volumes

⁠Configuration Parameters

Environment VariableDescriptionDefault
GIT_HOSTGit server hostnamegithub.com
GIT_REPO_URLSSH URL of Git repository (required)-
GIT_SUBFOLDER_PATHSubfolder path to sync"" (root)
GIT_SECRET_KEYSSH key private key""
GIT_BRANCHGit branch to trackmain
SYNC_INTERVALSync interval in seconds10

⁠Available Commands

  • sync Perform single synchronization
  • watch Continuous sync (default)

⁠Volumes

  • /sync: Destination path for synchronized files
  • /ssh: SSH configuration directory

Tag summary

Content type

Image

Digest

sha256:8d4b062b9…

Size

17.6 MB

Last updated

over 1 year ago

docker pull giraffacarp/gitsync