You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Danny Bessems 7fe18318d7 Update '.drone.yml' 3 weeks ago
init Update 'init/entrypoint.sh' 3 months ago
.drone.yml Update '.drone.yml' 3 weeks ago
Dockerfile Update 'Dockerfile' 4 months ago
README.md Update 'README.md' 4 months ago

README.md

Docker.Containers.GitSparseClone Build Status

Useful as a Kubernetes sidecar Container that downloads specific files from a git-repository (sparse clone) to a Kubernetes volumeMount, which other containers in the same Pod can then also mount and use.

Build:

docker build -t gitsparseclone .

Usage:

Create a deployment-with-sidecar.yml with the following contents:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-with-sidecar
  labels:
    app: deployment-with-sidecar
spec:
  replicas: 1
  selector:
    matchLabels:
      app: deployment-with-sidecar
  template:
    metadata:
      labels:
        app: deployment-with-sidecar
    spec:
      containers:
        - name: main
          image: <<name of your main-container image>>
          volumeMounts:
            - name: files
              readOnly: true
              mountPath: "/mnt/files"
        - name: sidecar
          image: djpbessems/gitsparseclone
          env:
            - name: SPARSE_CHECKOUT
              value: |-
                specific/folder/in/repository/*
                another/folder/in/repository/*
            - name: REMOTE_REPO
              value: <<fqdn of your git repository>
            - name: REMOTE_BRANCH
              value: <<branch of your git repository>>
            - name: TARGET_DIR
              value: /mnt/files
# Optional
            - name: http_proxy
              value: <<fqdn of your proxy>>
# Optional
            - name: https_proxy
              value: <<fqdn of your proxy>>
          volumeMounts:
            - name: files
              mountPath: "/mnt/files"
      volumes:
        - name: files
          emptyDir: {}

Then deploy to Kubernetes: kubectl apply -f deployment-with-sidecar.yml