Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow usage as a source of secrets via --link #7

Merged
merged 3 commits into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ FROM node:0.10.38-onbuild

RUN mkdir -p /vault

EXPOSE 3000
VOLUME /vault
5 changes: 4 additions & 1 deletion ONVAULT
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
# signals bash to stop execution on any fail
set -e

# allow overriding (probably trough Docker Link) default VAULT_PORT at runtime
: ${VAULT_PORT:=tcp://172.17.42.1:14242}

# allow overriding default VAULT_URI at runtime
: ${VAULT_URI:=http://172.17.42.1:14242}
: ${VAULT_URI:=${VAULT_PORT/tcp/http}}

# allow overriding default VAULT_SSH_KEY at runtime
: ${VAULT_SSH_KEY:=id_rsa}
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ docker-compose up vault

Happy codding!

## Usage in runtime

Although its main purpose is to fix the issue of building Docker images, it can also be used as a source of secrets for some running container:


```bash
docker run -v ~/.ssh:/vault/.ssh --name vault dockito/vault
docker run --link vault image-with-onvault ONVAULT npm install --unsafe-perm
```

## Development

Because [NPM](http://npmjs.com/) dependencies are installed locally, the dependencies installed in the base-image won't be available in development time, so you will need to `npm install` them again:
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# vault to be used as a service in build time
# must have a fixed IP and Port for discovery
vault:
build: .
volumes:
- .:/usr/src/app
- ~/.ssh:/vault/.ssh
ports:
- 172.17.42.1:14242:3000

# vault to be used as a linked container in runtime
runtime-vault:
build: .
volumes:
- .:/usr/src/app
- ~/.ssh:/vault/.ssh
ports:
- 3000

# Uses Vault in runtime
runtime-dependency:
build: sample-project
working_dir: /app
# entrypoint: ./ONVAULT
command: ls
volumes:
- .:/app
links:
- runtime-vault:vault
9 changes: 9 additions & 0 deletions sample-project/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# sample Docker image with ONVAULT installed
FROM ubuntu:14.04

# installs Dockito Vault ONVAULT utility
# https://github.com/dockito/vault
RUN apt-get update -y && \
apt-get install -y curl && \
curl -L https://raw.githubusercontent.com/dockito/vault/master/ONVAULT > /usr/local/bin/ONVAULT && \
chmod +x /usr/local/bin/ONVAULT