diff schema/Dockerfile @ 113:25b28fd0e256

Moved schema stuff to own subfolder.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 26 Jun 2018 16:14:59 +0200
parents Dockerfile@7f934f77831a
children dad6cf39691e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/Dockerfile	Tue Jun 26 16:14:59 2018 +0200
@@ -0,0 +1,42 @@
+FROM centos:7
+MAINTAINER tom.gottfried@intevation.de
+
+# Add the PostgreSQL PGP key to verify the official yum repository packages
+RUN rpm --import https://yum.postgresql.org/RPM-GPG-KEY-PGDG-10
+
+# Add PostgreSQL's repository. It contains the most recent release
+# of PostgreSQL, 10:
+RUN yum -q -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
+
+# Install PostgreSQL 10 and PostGIS
+RUN yum -q -y install postgresql10-server
+RUN yum -q -y install epel-release
+RUN yum -q -y install postgis24_10 pgtap10
+
+USER postgres
+ENV PGBIN /usr/pgsql-10/bin/
+
+# initdb PostgreSQL 10:
+ENV PGDATA /var/lib/pgsql/10/data
+RUN $PGBIN/initdb -E UTF8 2>&1 < /dev/null
+
+# Adjust PostgreSQL configuration so that remote connections to the
+# database are possible.
+ENV PGCONF /var/lib/pgsql/10/data/postgresql.conf
+RUN echo "host all  all    0.0.0.0/0  md5" >> /var/lib/pgsql/10/data/pg_hba.conf
+RUN echo "listen_addresses='*'" >> $PGCONF
+
+# Expose the PostgreSQL port
+EXPOSE 5432
+
+# Create WAMOS role and database
+ADD *.sql ./
+RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
+    psql -c "CREATE USER wamos PASSWORD 'wamos'" && \
+    createdb wamos && \
+    psql -f wamos.sql -d wamos && \
+    psql -f auth.sql -d wamos && \
+    $PGBIN/pg_ctl stop -m smart
+
+# Set the default command to run when starting the container
+CMD ["/usr/pgsql-10/bin/postgres", "-D", "/var/lib/pgsql/10/data"]