Skip to content
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
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM stakater/node:6.9
LABEL authors="Ali Tariq <ali.chaudhary2009@gmail.com>"
MAINTAINER "Stakater Team"

RUN npm install -g git2consul \
&& apk update && apk upgrade && apk add --no-cache bash git openssh
RUN npm install -g git2consul@0.12.13 \
&& apk -Uuv add --no-cache git openssh 'su-exec>=0.2'

RUN rm -rf /etc/service/node && mkdir -p /etc/service/git2consul
ADD start.sh /etc/service/git2consul/run


ENV COMMAND="git2consul --endpoint 127.0.0.1 --port 80 --config-file /home/git2consul/config.json"
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# dockerfile-git2consul
dockerfile image for git2consul
# Dockerfile-git2consul
Dockerfile image for git2consul
<h3>git2consul </h3>
`git2consul` takes one or more git repositories and then map them on to the consul server. Target is to read configurations from git repo and save them as key value pairs in consul server. <br>
Any change in git repo is mapped on to the consul server after every 1 minute.
<h3>Usage</h3>
To run the docker container of `git2consul`, set command in environment variable `command`.
<br>E.g:<br> ```docker run -d -e COMMAND="git2consul --endpoint 127.0.0.1 --port 80 --config-file /home/git2consul/config.json" -v /home/git2consul/:/home/git2consul stakater/git2consul:0.12.13```
<br>

where endpoint is the location of the consul server, port is the consul server port and config.json file contains the information of git repository and some other configurations of `git2consul`.
<br>
Example `config.json`:
```
{
"version": "1.0",
"repos" : [{
"name" : "keyValue pairs",
"url" : "your git repo link",
"branches" : ["dev"],
"include_branch_name" : false,
"ignore_repo_name" : true,
"ignore_file_extension" : true,
"expand_keys": true,
"hooks": [{
"type" : "polling",
"interval" : "1"
}]
}]
}
```
You can learn more about `git2consul` configurations [here](https://github.com/breser/git2consul).<br>
If you do not set command in environment variable `command`, container will run default command, which is as follow: <br>
`git2consul --endpoint 127.0.0.1 --port 80 --config-file /home/git2consul/config.json`
<h3>Available Versions</h3>
`v0.12.13`
<h3>Layers</h3>
alpine:3.5 > stakater/base-alpine:3.5 > stataker/node/6.9 > stakater/git2consul
14 changes: 14 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

# Convert COMMAND variable into an array
# Simulating positional parameter behaviour
IFS=' ' read -r -a CMD_ARRAY <<< "$COMMAND"

# explicitly setting positional parameters ($@) to CMD_ARRAY
set -- "${CMD_ARRAY[@]}"
# From this point, positional parameters ($@)will be set to the parameters in the COMMAND variable.

# chown home and data folder
chown -R stakater /home/git2consul
exec su-exec stakater "$@"