Skip to content

adds ability to dynamically set config env variable #2

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

Merged
merged 1 commit into from
Jun 13, 2019
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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ENV PORT=3000
EXPOSE ${PORT}

# Which configuration in the config.json file to load
ENV CONFIG="production"
ARG CONFIG="production"
ENV CONFIG=${CONFIG}

# Location of config.json
ENV CONFIG_DIR=/usr/src/app/config/
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Flow for automated deployment:

This webhook is intended for use with private Docker Hub repositories and self hosted Docker Swarm instances.

To get started, clone this repository, add an image of it to your Docker Hub account, configure `config.json` and deploy it to your Docker Swarm as a service (see steps below).
To get started, clone this repository, add an image of it to your Docker Hub account, configure config.json and deploy it to your Docker Swarm as a service (see steps below).

[Read more about this service in this blog post.](https://medium.com/@iaincollins/docker-swarm-automated-deployment-cb477767dfcf)

Expand All @@ -27,6 +27,14 @@ Supported environment variables:
USERNAME="docker-hub-username" // A Docker Hub account username
PASSWORD="docker-hub-password" // A Docker Hub account password

**note:** the value for `CONFIG` environment variable can be passed in at image build time:

```
docker build \
--build-arg CONFIG=part-of-config-dot-json-file-to-load \
-t docker-hub-username/docker-deploy-webhook .
```

The `config.json` file defines each environment:

{
Expand Down