diff backend/doc/schema/Dockerfile @ 8817:8927ec8a3c32

Add demodata and fix server startup in DB Dockerfile.
author Tom Gottfried <tom@intevation.de>
date Wed, 10 May 2017 12:09:14 +0200
parents 13d5b6c67cef
children
line wrap: on
line diff
--- a/backend/doc/schema/Dockerfile	Tue May 09 18:42:56 2017 +0200
+++ b/backend/doc/schema/Dockerfile	Wed May 10 12:09:14 2017 +0200
@@ -25,7 +25,7 @@
 # Install packages
 #
 RUN apt-get update && \
-    apt-get install -y postgresql-9.4-postgis-2.1 postgis
+    apt-get install -y postgresql-9.4-postgis-2.1 postgis curl
 
 #
 # Use user postgres to run the next commands
@@ -42,7 +42,8 @@
 RUN echo "host all  all    0.0.0.0/0  md5" >> \
     /etc/postgresql/9.4/main/pg_hba.conf
 
-RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf
+ENV PGCONF /etc/postgresql/9.4/main/postgresql.conf
+RUN echo "listen_addresses='*'" >> $PGCONF
 
 #
 # Expose the PostgreSQL port
@@ -58,8 +59,20 @@
 #
 ADD . /opt/d4eriver_db
 
-RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wD /etc/postgresql/9.4/main/ && \
-    /opt/d4eriver_db/postgresql-setup.sh
+# Go to postgres home for write permissions
+WORKDIR /var/lib/postgresql
+ENV DATA_ARCH demodaten_3.1.10-bis-3.2.x.tar.gz
+RUN curl -k "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
+    tar xz
+
+ENV PGDATA /var/lib/postgresql/9.4/main
+RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wo "--config_file=$PGCONF" && \
+    /opt/d4eriver_db/postgresql-setup.sh && \
+    psql -f demodaten/d4e_demodata.dump.sql d4e && \
+    createuser -S -D -R seddb && \
+    createdb seddb && \
+    psql -f demodaten/seddb_demodata.dump.sql seddb && \
+    /usr/lib/postgresql/9.4/bin/pg_ctl stop
 
 #
 # Set the default command to run when starting the container

http://dive4elements.wald.intevation.org