diff --git a/README.md b/README.md index 3a0c092..dc0a0ec 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,61 @@ # Docker.Containers.GitSparseClone [![Build Status](https://ci.spamasaurus.com/api/badges/djpbessems/Docker.Containers.GitSparseClone/status.svg)](https://ci.spamasaurus.com/djpbessems/Docker.Containers.GitSparseClone) -Useful as a Kubernetes-sidecar container that downloads files from a git-repository to a Kubernetes-volumeMount, which other containers can then also mount and use. +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. -### Usage: +### Build: +`docker build -t gitsparseclone .` + +### Usage: +Create a `deployment-with-sidecar.yml` with the following contents: ``` -docker run -it \ - -e SPARSE_CHECKOUT= \ - -e REMOTE_REPO= \ - -e REMOTE_BRANCH= \ - -e TARGET_DIR= \ +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: <> + 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: < + - name: REMOTE_BRANCH + value: <> + - name: TARGET_DIR + value: /mnt/files # Optional - -e FLATTEN_FOLDER=true \ --d djpbessems/git-sidecar -``` \ No newline at end of file + - name: http_proxy + value: <> +# Optional + - name: https_proxy + value: <> + volumeMounts: + - name: files + mountPath: "/mnt/files" + volumes: + - name: scripts + emptyDir: {} +``` + +Then deploy to Kubernetes: +`kubectl apply -f deployment-with-sidecar.yml` \ No newline at end of file