From 7f93df3014a113988ed3a13cb545bd13bd10b1e8 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 2 Feb 2018 20:16:26 +0100 Subject: [PATCH] Add Ushahidi data directory as persistent volume --- ushahidi.sh | 3 ++- ushahidi/Dockerfile | 2 ++ ushahidi/etc/init.d/ushahidi | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ushahidi.sh b/ushahidi.sh index 78d4eec..d8d3f84 100755 --- a/ushahidi.sh +++ b/ushahidi.sh @@ -13,7 +13,8 @@ export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64) envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i mariadb mysql # Configure Ushahidi -mkdir -p /srv/ushahidi/conf +mkdir -p /srv/ushahidi/conf /srv/ushahidi/data +chown 8014:8014 /srv/ushahidi/data envsubst <${SOURCE_DIR}/srv/ushahidi/conf/env >/srv/ushahidi/conf/env # Populate database diff --git a/ushahidi/Dockerfile b/ushahidi/Dockerfile index e9b52fd..a4e3f3d 100644 --- a/ushahidi/Dockerfile +++ b/ushahidi/Dockerfile @@ -17,11 +17,13 @@ RUN \ # Create OS user && addgroup -S -g 8014 ushahidi \ && adduser -S -u 8014 -h /srv/ushahidi -s /bin/false -g ushahidi -G ushahidi ushahidi \ + && chown -R ushahidi:ushahidi /srv/ushahidi/platform/application/logs /srv/ushahidi/platform/application/cache /srv/ushahidi/platform/application/media/uploads \ # Cleanup && rm -rf /tmp/ushahidi.tgz /tmp/ushahidi-platform-release-v3.8.0 COPY docker/ / +VOLUME ["/srv/ushahidi/platform/application/media/uploads"] EXPOSE 8014 CMD ["s6-svscan", "/etc/services.d"] diff --git a/ushahidi/etc/init.d/ushahidi b/ushahidi/etc/init.d/ushahidi index 39f05e1..3a7e291 100755 --- a/ushahidi/etc/init.d/ushahidi +++ b/ushahidi/etc/init.d/ushahidi @@ -15,6 +15,7 @@ start() { --link mariadb \ -p 127.0.0.1:8014:8014 \ -v /srv/ushahidi/conf/env:/srv/ushahidi/platform/.env \ + -v /srv/ushahidi/data:/srv/ushahidi/platform/application/media/uploads \ ushahidi }