diff --git a/Dockerfile b/Dockerfile index c3f3899..dc08dc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ RUN apt-get update && apt-get install -y \ pkg-config \ python \ supervisor \ - && rm -rf /var/lib/apt/lists/* @@ -30,9 +29,13 @@ RUN cd /opt && git clone https://github.com/ether/etherpad-lite.git etherpad # Install node dependencies RUN /opt/etherpad/bin/installDeps.sh +#mk dir for settins +RUN mkdir -p /opt/vol/ + # Add conf files ADD settings.json /opt/etherpad/settings.json ADD supervisor.conf /etc/supervisor/supervisor.conf +ADD start.sh /usr/bin/start.sh EXPOSE 9001 -CMD ["supervisord", "-c", "/etc/supervisor/supervisor.conf", "-n"] +CMD ["start.sh"] diff --git a/README.md b/README.md index f858c46..de954e0 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,9 @@ To run Etherpad on port 80, run: `docker run -d -p 80:9001 leibnitius/etherpad-docker` -To edit the Etherpad settings.json, it is necessary to clone the Git repository: +To use your custom Etherpad settings.json, the file has to be located at `/var/config/settings.json`. +Then run: -`git clone git://github.com/ether/etherpad-docker.git && cd etherpad-docker` - -Then edit the settings.json to your liking and run: - -`docker build -t /etherpad-docker .` +`docker run -d -v /var/config:/opt/vol -p 9001:9001 leibnitius/etherpad-docker` This image could also be used as a base for Docker Etherpad images integrated with MySQL, etc. diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..8f9b588 --- /dev/null +++ b/start.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -f /opt/vol/settings.json ]; then + echo "Volume with config was loaded" + echo "Using injected config…" + cp /opt/vol/settings.json /opt/etherpad/settings.json +else + echo "Using default config" +fi + +if [ -f /opt/vol/APIKEY.txt ]; then + echo "Using custom apikey" + cp /opt/vol/APIKEY.txt /opt/etherpad/APIKEY.txt +else + echo "using generated api key" + cat /opt/etherpad/APIKEY.txt +fi + +supervisord -c /etc/supervisor/supervisor.conf -n