Mercurial > gemma
changeset 4165:8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 05 Aug 2019 13:51:08 +0200 |
parents | 6f9d00c8cc38 |
children | 04876d865528 |
files | docker/Dockerfile.pg docker/README.md |
diffstat | 2 files changed, 73 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docker/Dockerfile.pg Mon Aug 05 13:51:08 2019 +0200 @@ -0,0 +1,70 @@ +FROM ubuntu:bionic +LABEL authors="tom.gottfried@intevation.de" +LABEL description="Contains software from gemma, for right holders and\ + licensing infos, see https://hg.intevation.de/gemma ." + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update &&\ + apt-get -y install git make gcc libreadline-dev zlib1g-dev flex bison + +# Add PostgreSQL's repository +WORKDIR /opt/ +RUN git clone git://git.postgresql.org/git/postgresql.git +WORKDIR /opt/postgresql +RUN git checkout REL_11_STABLE + +ENV PGDATA /usr/local/pgsql/data +ENV PGBIN /usr/local/pgsql/bin +ENV PGCONF /usr/local/pgsql/data/postgresql.conf + +# Install PostgreSQL from sources +RUN ./configure && make && make install + +# Install PostGIS dependencies +RUN apt-get -y install autoconf xsltproc \ + libproj-dev libgeos-dev libxml2-dev libjson-c-dev libgdal-dev + +# Add PostGIS repository and build it +WORKDIR /opt/ +RUN git clone https://git.osgeo.org/gitea/postgis/postgis.git +WORKDIR /opt/postgis +RUN git checkout svn-2.5 +RUN ./autogen.sh && ./configure --with-pgconfig=$PGBIN/pg_config && \ + make comments && make && make install + +# Build btree_gist extension +WORKDIR /opt/postgresql/contrib/btree_gist +RUN make && make install + +# Put PostgreSQL executables in path +ENV PATH $PGBIN:$PATH + +# Initialize cluster +RUN mkdir -p $PGDATA && useradd postgres -d $PGDATA && chown postgres $PGDATA +USER postgres +RUN $PGBIN/initdb -D $PGDATA + +RUN \ + # Adjust PostgreSQL configuration to allow remote connections + echo "host all all 0.0.0.0/0 md5" \ + >> /usr/local/pgsql/data/pg_hba.conf &&\ + echo "listen_addresses='*'" >> $PGCONF &&\ + # Set port to standard value + sed -i '/port/s/543./5432/' $PGCONF &&\ + # Keep log on stderr to be able to use docker logs + sed -i '/logging_collector/s/on/off/' $PGCONF + +# Expose the PostgreSQL port +EXPOSE 5432 + +# Create GEMMA role and database +WORKDIR /opt/gemma +COPY schema/*.sql schema/*.sh ./ +COPY schema/demo-data ./demo-data/ +RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \ + PATH=$PGBIN:$PATH ./install-db.sh --demo --metapw "geo2Serv" && \ + $PGBIN/pg_ctl stop -m smart + +# Set the default command to run when starting the container +CMD ["/usr/local/pgsql/bin/postgres", "-D", "/usr/local/pgsql/data"]
--- a/docker/README.md Fri Aug 02 18:13:58 2019 +0200 +++ b/docker/README.md Mon Aug 05 13:51:08 2019 +0200 @@ -97,6 +97,9 @@ docker build -t gemma_db -f docker/Dockerfile.db . ``` +In order to test the latest upstream PostgreSQL 11 and PostGIS 2.5, +use Dockerile.pg instead. + Get a running instance with e.g.: ```shell