Fix a bug that config.json is not created

Do not copy config.json into /matteronst/config directly because:

> Changes to a data volume will not be included when you update an image.
>
> -- https://docs.docker.com/engine/userguide/dockervolumes/

Instead copy config.template.json into the root and generate
/mattermost/config/config.json from the file.
This commit is contained in:
Yi EungJun 2015-12-04 17:58:43 +09:00
parent c1c06ec5a3
commit 2d908b3cca
4 changed files with 10 additions and 6 deletions

View File

@ -14,12 +14,10 @@ exec bin/platform\n'\
RUN wget https://github.com/mattermost/platform/releases/download/v1.2.1/mattermost.tar.gz \ RUN wget https://github.com/mattermost/platform/releases/download/v1.2.1/mattermost.tar.gz \
&& tar -xvzf mattermost.tar.gz && rm mattermost.tar.gz && tar -xvzf mattermost.tar.gz && rm mattermost.tar.gz
ADD config/config.json /mattermost/config/ COPY config.template.json /
ADD docker-entry.sh / COPY docker-entry.sh /
RUN chmod +x /docker-entry.sh RUN chmod +x /docker-entry.sh
ENTRYPOINT /docker-entry.sh ENTRYPOINT /docker-entry.sh
VOLUME ["/mattermost/config"]
EXPOSE 80 EXPOSE 80

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
echo Starting Platform echo Starting Platform
sed -Ei "s/PG_ADDR/$PG_PORT_5432_TCP_ADDR/" /mattermost/config/config.json config=/mattermost/config/config.json
sed -Ei "s/PG_PORT/$PG_PORT_5432_TCP_PORT/" /mattermost/config/config.json if [ ! -f $config ]; then
cp /config.template.json $config
sed -Ei "s/PG_ADDR/$PG_PORT_5432_TCP_ADDR/" $config
sed -Ei "s/PG_PORT/$PG_PORT_5432_TCP_PORT/" $config
fi
cd /mattermost/bin cd /mattermost/bin
./platform ./platform

View File

@ -4,6 +4,8 @@ app:
build: app build: app
links: links:
- db:pg - db:pg
volumes:
- ./volumes/app/mattermost/config:/mattermost/config:rw
web: web:
build: web build: web
ports: ports: