From 2d908b3cca955ba28852e77d9e6cc631041b5255 Mon Sep 17 00:00:00 2001 From: Yi EungJun Date: Fri, 4 Dec 2015 17:58:43 +0900 Subject: [PATCH] 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. --- app/Dockerfile | 6 ++---- app/{config/config.json => config.template.json} | 0 app/docker-entry.sh | 8 ++++++-- docker-compose.yml | 2 ++ 4 files changed, 10 insertions(+), 6 deletions(-) rename app/{config/config.json => config.template.json} (100%) diff --git a/app/Dockerfile b/app/Dockerfile index bcdf181..e4dc1ab 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -14,12 +14,10 @@ exec bin/platform\n'\ RUN wget https://github.com/mattermost/platform/releases/download/v1.2.1/mattermost.tar.gz \ && tar -xvzf mattermost.tar.gz && rm mattermost.tar.gz -ADD config/config.json /mattermost/config/ -ADD docker-entry.sh / +COPY config.template.json / +COPY docker-entry.sh / RUN chmod +x /docker-entry.sh ENTRYPOINT /docker-entry.sh -VOLUME ["/mattermost/config"] - EXPOSE 80 diff --git a/app/config/config.json b/app/config.template.json similarity index 100% rename from app/config/config.json rename to app/config.template.json diff --git a/app/docker-entry.sh b/app/docker-entry.sh index 0fb3bd3..4904f16 100644 --- a/app/docker-entry.sh +++ b/app/docker-entry.sh @@ -1,6 +1,10 @@ #!/bin/bash echo Starting Platform -sed -Ei "s/PG_ADDR/$PG_PORT_5432_TCP_ADDR/" /mattermost/config/config.json -sed -Ei "s/PG_PORT/$PG_PORT_5432_TCP_PORT/" /mattermost/config/config.json +config=/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 ./platform diff --git a/docker-compose.yml b/docker-compose.yml index 3c1c8c6..c69839b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ app: build: app links: - db:pg + volumes: + - ./volumes/app/mattermost/config:/mattermost/config:rw web: build: web ports: