comparison docker/Dockerfile.db @ 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 156a805941b5
children ce24990b3d5c
comparison
equal deleted inserted replaced
1107:d1fb2babaa95 1108:5adee8b0e29f
1 FROM centos:7 1 FROM ubuntu:bionic
2 LABEL authors="tom.gottfried@intevation.de" 2 LABEL authors="tom.gottfried@intevation.de"
3 3
4 # Add the PostgreSQL PGP key to verify the official yum repository packages 4 RUN apt-get update &&\
5 RUN rpm --import https://yum.postgresql.org/RPM-GPG-KEY-PGDG-10 &&\ 5 apt-get -y install --no-install-recommends curl gnupg
6 # Add PostgreSQL's repository. It contains the most recent release 6
7 # of PostgreSQL, 10: 7 # Add PostgreSQL's repository for current PostgreSQL release and extensions:
8 yum -q -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm &&\ 8 RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main' \
9 # Install PostgreSQL 10 and PostGIS 9 >> /etc/apt/sources.list &&\
10 yum -q -y install postgresql10-server &&\ 10 curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
11 yum -q -y install epel-release &&\ 11 sudo apt-key add - &&\
12 yum -q -y install postgis24_10 pgtap10 12 apt-get update &&\
13 apt-get -y install postgresql-11-postgis-2.5 postgresql-11-pgtap
14
13 USER postgres 15 USER postgres
14 ENV PGBIN /usr/pgsql-10/bin/ 16 ENV PGBIN /usr/lib/postgresql/11/bin
17 ENV PGDATA /var/lib/postgresql/11/main
18 ENV PGCONF /etc/postgresql/11/main/postgresql.conf
15 19
16 # initdb PostgreSQL 10: 20 RUN \
17 ENV PGDATA /var/lib/pgsql/10/data 21 # Adjust PostgreSQL configuration to allow remote connections
18 ENV PGCONF /var/lib/pgsql/10/data/postgresql.conf 22 echo "host all all 0.0.0.0/0 md5" \
19 RUN $PGBIN/initdb -E UTF8 2>&1 < /dev/null &&\ 23 >> /etc/postgresql/11/main/pg_hba.conf &&\
20 # Adjust PostgreSQL configuration so that remote connections to the
21 # database are possible.
22 echo "host all all 0.0.0.0/0 md5" >> /var/lib/pgsql/10/data/pg_hba.conf &&\
23 echo "listen_addresses='*'" >> $PGCONF &&\ 24 echo "listen_addresses='*'" >> $PGCONF &&\
25 # Set port to standard value
26 sed -i '/port/s/543./5432/' $PGCONF &&\
24 # Keep log on stderr to be able to use docker logs 27 # Keep log on stderr to be able to use docker logs
25 sed -i '/logging_collector/s/on/off/' $PGCONF 28 sed -i '/logging_collector/s/on/off/' $PGCONF
29
26 # Expose the PostgreSQL port 30 # Expose the PostgreSQL port
27 EXPOSE 5432 31 EXPOSE 5432
28 32
29 # Create GEMMA role and database 33 # Create GEMMA role and database
30 WORKDIR /opt/gemma 34 WORKDIR /opt/gemma
33 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \ 37 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
34 ./install-db.sh --demo --metapw "geo2Serv" && \ 38 ./install-db.sh --demo --metapw "geo2Serv" && \
35 $PGBIN/pg_ctl stop -m smart 39 $PGBIN/pg_ctl stop -m smart
36 40
37 # Set the default command to run when starting the container 41 # Set the default command to run when starting the container
38 CMD ["/usr/pgsql-10/bin/postgres", "-D", "/var/lib/pgsql/10/data"] 42 CMD ["/usr/lib/postgresql/11/bin/postgres", "-D", "/etc/postgresql/11/main"]