Commit 02774d9f authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Allow more flexibility to specify paths in example entrypoint

Override directory paths with environment variables that can be given
in a Dockerfile or when run from the command line.
parent 0c866840
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ If you use this script `docker-init.sh` must be installed at
added to a Dockerfile:

```
ENV ENV_DIRECTORY=/etc/environment.d/ INIT_DIRECTORY=/etc/init.d
ADD https://code.kodo.org.uk/kodo.org.uk/docker-init/raw/master/docker-init.sh /lib/docker-init.sh
ADD https://code.kodo.org.uk/kodo.org.uk/docker-init/raw/master/docker-entrypoint.sh /bin/entrypoint
RUN chmod +x /bin/entrypoint
@@ -18,4 +19,6 @@ ENTRYPOINT ["/bin/entrypoint"]
```

Any environment variable files can then be installed to `/etc/environment.d/`
and init script fragments go into `/etc/init.d/`.
and init script fragments go into `/etc/init.d/`.  These two directories can 
be overridden with the `ENV_DIRECTORY` and `INIT_DIRECTORY` environment 
variables respectively.
+2 −2
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@
. /lib/docker-init.sh

# Source environment variables from /etc/environment.d/
source_each /etc/environment.d/*
source_each ${ENV_DIRECTORY-/etc/environment.d}/*

# Run all setup scripts in /etc/init.d/
exec_each /etc/init.d/*
exec_each ${INIT_DIRECTORY-/etc/init.d}/*

# Run the given command or a shell
[ -n "$1" ] || set ${SHELL:=/bin/sh}