Mirror Bitbucket / Gitlab / Github repositories using simple webhooks. Alpine based, pure bash
100K+
docker run -it \
-e [email protected]:vendor/src_repo.git \
-e [email protected]:2222/vendor/dest_repo.git \
-e SRC_DEPLOY_KEY=base64_encoded_key \
-e DEST_DEPLOY_KEY=base64_encoded_key \
-p 8181:8080/tcp \
karser/gitbitlabhub
where SRC_DEPLOY_KEY and DEST_DEPLOY_KEY can be obtained by running
base64 -w 0 < ~/.ssh/project_src_id_rsa
base64 -w 0 < ~/.ssh/project_dest_id_rsa
The URL will be http://localhost:8181
version: '3.3'
services:
gitbitlabhub_repo1:
image: karser/gitbitlabhub
restart: always
networks:
- webproxy
environment:
SRC_REPO: '[email protected]:vendor/src_repo.git'
DEST_REPO: '[email protected]:2222/vendor/dest_repo.git'
SRC_DEPLOY_KEY: 'base64_encoded_key'
DEST_DEPLOY_KEY: 'base64_encoded_key'
labels:
- "traefik.enable=true"
- "traefik.backend=gitbitlabhub_repo1"
- "traefik.frontend.rule=Host:gitbitlabhub.example.com;PathPrefixStrip:/vendor/src_repo"
- "traefik.port=8080"
- "traefik.docker.network=webproxy"
volumes:
- ./gitbitlabhub:/storage
networks:
webproxy:
external: true
The URL will be https://gitbitlabhub.example.com/vendor/src_repo
ssh-keygen -t rsa -f ~/.ssh/project_src_id_rsa
ssh-keygen -t rsa -f ~/.ssh/project_dest_id_rsa
Add these keys to the repository settings of source and destination correspondingly.
cat ~/.ssh/project_src_id_rsa.pub
cat ~/.ssh/project_dest_id_rsa.pub
The Source deployment key can be marked as readonly. Depending on the platform it's called Deploy Token or Access key. See how to add deployment/access keys to bitbucket, bitbucket access keys, gitlab, github.
Run this container with all environment variables configured properly (see How to use section).
Create the webhook in the source repository. See how to create a webhook in bitbucket, gitlab, github.
docker build --tag karser/gitbitlabhub:latest .
docker push karser/gitbitlabhub:latest
Content type
Image
Digest
sha256:f5d894050…
Size
11.8 MB
Last updated
almost 2 years ago
docker pull karser/gitbitlabhub