view docker/Dockerfile.pg @ 4611:b5aa1eb83bb0 geoserver_sql_views

Add possibility to configure SRS for GeoServer SQL view Automatic detection of spatial reference system for SQL views in GeoServer does not always find the correct SRS.
author Tom Gottfried <tom@intevation.de>
date Fri, 06 Sep 2019 11:58:03 +0200
parents 8d6f43894f09
children 71f73df1356d
line wrap: on
line source

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

# Add pgTAP repository and build it
WORKDIR /opt
RUN git clone https://github.com/theory/pgtap.git
WORKDIR /opt/pgtap
RUN make && make install

# 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"]