Mercurial > gemma
changeset 1108:5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Now all Dockerfiles use the same base image respectively
operating system. At the same time upgraded PostgreSQL and PostGIS
to current stable releases.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 02 Nov 2018 17:21:33 +0100 |
parents | d1fb2babaa95 |
children | 74a75a5ce770 |
files | docker/Dockerfile.db |
diffstat | 1 files changed, 23 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/docker/Dockerfile.db Fri Nov 02 16:27:54 2018 +0100 +++ b/docker/Dockerfile.db Fri Nov 02 17:21:33 2018 +0100 @@ -1,28 +1,32 @@ -FROM centos:7 +FROM ubuntu:bionic LABEL authors="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: - 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 - yum -q -y install postgresql10-server &&\ - yum -q -y install epel-release &&\ - yum -q -y install postgis24_10 pgtap10 +RUN apt-get update &&\ + apt-get -y install --no-install-recommends curl gnupg + +# Add PostgreSQL's repository for current PostgreSQL release and extensions: +RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main' \ + >> /etc/apt/sources.list &&\ + curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | \ + sudo apt-key add - &&\ + apt-get update &&\ + apt-get -y install postgresql-11-postgis-2.5 postgresql-11-pgtap + USER postgres -ENV PGBIN /usr/pgsql-10/bin/ +ENV PGBIN /usr/lib/postgresql/11/bin +ENV PGDATA /var/lib/postgresql/11/main +ENV PGCONF /etc/postgresql/11/main/postgresql.conf -# initdb PostgreSQL 10: -ENV PGDATA /var/lib/pgsql/10/data -ENV PGCONF /var/lib/pgsql/10/data/postgresql.conf -RUN $PGBIN/initdb -E UTF8 2>&1 < /dev/null &&\ - # Adjust PostgreSQL configuration so that remote connections to the - # database are possible. - echo "host all all 0.0.0.0/0 md5" >> /var/lib/pgsql/10/data/pg_hba.conf &&\ +RUN \ + # Adjust PostgreSQL configuration to allow remote connections + echo "host all all 0.0.0.0/0 md5" \ + >> /etc/postgresql/11/main/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 @@ -35,4 +39,4 @@ $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"] +CMD ["/usr/lib/postgresql/11/bin/postgres", "-D", "/etc/postgresql/11/main"]