A docker image that builds docker images from Git repositories
565
Builds docker images from Git repositories
git clone,docker build,docker push... repeat :musical_note:
Use the following environment variables to control the building process
GIT_REPO: Any git repository with a Dockerfile to clone and build, example: [email protected]:username/repo.git
IMAGE_TAG: The docker tag used to push the image to a registry, example: <username>/<repo>:<tag>
Requires running as a privileged container, no docker.sock is necessary.
Use the environment variable SSH_KEY to provide a base64'd private key to access the private repo.
Example:
$ ssh-keygen -t rsa -b 4096 -q -P "" -C "[email protected]" -f deploy_key
$ ls
> deploy_key deploy_key.pub
The file deploy_key is what you encode as base64:
base64 deploy_key > deploy_key.key.base64
Then you add the content of the file deploy_key.key.base64 in the SSH_KEY env variable.
The other file, deploy_key.pub, is what you add to your github repo as Deploy Key
Note: passphrases are not supported in deploy keys
Use the environment variables DOCKER_USER and DOCKER_PASS.
DOCKER_ENDPOINT is also available to specify a custom registry.
docker run --privileged --name test-git-builder -e "DOCKER_USER=?" -e "DOCKER_PASS=?" -e "SSH_KEY=`deploy_key.key.base64`" -e "[email protected]:username/repo.git" -e "IMAGE_TAG=docker-username/docker-repo:docker-repo-tag" bithavoc/git-builder
MIT
Content type
Image
Digest
Size
49.7 MB
Last updated
over 9 years ago
docker pull bithavoc/git-builder