view docker/Dockerfile.pg @ 5702:fe83406fe7ed sr-v2

Fix bug in sorting the vertices.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 14 Feb 2024 22:38:14 +0100
parents 71f73df1356d
children
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 stable-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"]