Minimal Git CLI container build from scratch. I use this as init container on Kubernetes.
The container is optimized with UPX and only contains the binaries needed for a git clone from HTTP or HTTPS, NO SSH SUPPORT. This is a personal choice, if needed I can add it :)
docker run -v $PWD:/config lansible/git-clone \
clone --depth 1 https://github.com/LANsible/git-container.git /config
In the following examples an init container pulls a git repository into a shared emptyDir volume.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: example
spec:
initContainers:
- image: lansible/git-clone:latest
name: init-config
command: ['--depth 1 https://github.com/wilmardo/home-assistant.git /config']
volumeMounts:
- mountPath: /config
name: config
containers:
- image: main/main-container
name: main-container
volumeMounts:
- mountPath: /config
name: config
volumes:
- name: config
emptyDir: {}