fpco/gitmirror
This image uses dustin/gitmirror to mirror git
repositories from one place to another (e.g. from public Github to a private
Gitlab instance). It will listen for webhook requests to trigger updating the
mirror.
Listens on port 8124 for webhook requests, where the path must match the repo name. E.g. curl http://localhost:8124/stackage-server.git
.
Environment variables
DEFAULT_MIRROR_PREFIX
: Default prefix for location to mirror repositories
triggered by a Github webhook (unless overridden inMIRRORS
below). For example,https://USER:PASSWORD@gitlab.example.com/mirrors
means that if a webhook forhttps://gitmirror.example.com/foo.git
is mirrored tohttps://USER:PASSWORD@gitlab.example.com/mirrors/foo.git
.DEFAULT_MIRROR_PUSH_ARGS
: Default arguments to pass togit push
when
pushing the mirror. Default is--mirror
, but you might want to override this
to (a) specific branch name(s).MIRRORS
: List of repositories to mirror and their destinations. Each line is
one repository, and has the formatNAME.git ORIGIN_URL GIT_PUSH_ARGS
. For
example, this mirrors themaster
andprod
branches ofstackage-server
,
and all branches ofstack
:stackage-server.git https://github.com/fpco/stackage-server.git https://USER:PASSWORD@gitlab.example.com/mirrors/stackage-server.git master prod stack.git https://github.com/commercialhaskell/stack.git https://USER:PASSWORD@gitlab.example.com/mirrors/stack.git --mirror
GITMIRROR_SECRET
: Secret token required for Github webhooks
(see Github's documentation).
If omitted or blank, no secret token is required.GITMIRROR_DIR
: Directory to store the mirrors. Defaults to/gitmirror
. You
may wish to volume mount this so that restarting the container doesn't require
the repos to be re-cloned.