1
0
Fork 0
mirror of https://github.com/Luzifer/git-credential-vault.git synced 2024-12-23 03:01:17 +00:00

Add example for git clone

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-04-01 15:56:19 +02:00
parent ff4c12902e
commit 272b7718fb
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -34,6 +34,30 @@ password=myverysecrettoken
protocol=https protocol=https
``` ```
### Dockerfile example (git clone)
In this example the `VAULT_TOKEN` is passed in through a build-arg which means you **MUST** revoke the token before pushing the image, otherwise you will be leaking an active credential!
```Dockerfile
FROM alpine
ARG VAULT_ADDR
ARG VAULT_TOKEN
RUN set -ex \
&& apk --no-cache add curl git \
&& curl -sSfL "https://github.com/Luzifer/git-credential-vault/releases/download/v0.1.0/git-credential-vault_linux_amd64.tar.gz" | tar -xz -C /usr/bin \
&& mv /usr/bin/git-credential-vault_linux_amd64 /usr/bin/git-credential-vault \
&& git config --global credential.helper 'vault --vault-path-prefix secret/git-credentials'
RUN set -ex \
&& git clone https://github.com/myuser/secretrepo.git /src
```
```console
# docker build --build-arg VAULT_ADDR=${VAULT_ADDR} --build-arg VAULT_TOKEN=${VAULT_TOKEN} --no-cache .
```
### Dockerfile example (go get) ### Dockerfile example (go get)
In this example the `VAULT_TOKEN` is passed in through a build-arg which means you **MUST** revoke the token before pushing the image, otherwise you will be leaking an active credential! In this example the `VAULT_TOKEN` is passed in through a build-arg which means you **MUST** revoke the token before pushing the image, otherwise you will be leaking an active credential!