annotate schema/Dockerfile @ 306:70592a18c5c6

Keep log on stderr to be able to use docker logs
author Tom Gottfried <tom@intevation.de>
date Wed, 01 Aug 2018 15:18:26 +0200
parents 299568ad3c37
children 41b37a531843
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 FROM centos:7
157
a85c44438d48 fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents: 156
diff changeset
2 LABEL authors="tom.gottfried@intevation.de"
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 # Add the PostgreSQL PGP key to verify the official yum repository packages
156
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
5 RUN rpm --import https://yum.postgresql.org/RPM-GPG-KEY-PGDG-10 &&\
157
a85c44438d48 fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents: 156
diff changeset
6 # Add PostgreSQL's repository. It contains the most recent release
a85c44438d48 fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents: 156
diff changeset
7 # of PostgreSQL, 10:
156
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
8 yum -q -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm &&\
157
a85c44438d48 fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents: 156
diff changeset
9 # Install PostgreSQL 10 and PostGIS
156
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
10 yum -q -y install postgresql10-server &&\
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
11 yum -q -y install epel-release &&\
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
12 yum -q -y install postgis24_10 pgtap10
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13 USER postgres
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 ENV PGBIN /usr/pgsql-10/bin/
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16 # initdb PostgreSQL 10:
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 ENV PGDATA /var/lib/pgsql/10/data
156
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
18 ENV PGCONF /var/lib/pgsql/10/data/postgresql.conf
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
19 RUN $PGBIN/initdb -E UTF8 2>&1 < /dev/null &&\
157
a85c44438d48 fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents: 156
diff changeset
20 # Adjust PostgreSQL configuration so that remote connections to the
a85c44438d48 fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents: 156
diff changeset
21 # database are possible.
156
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
22 echo "host all all 0.0.0.0/0 md5" >> /var/lib/pgsql/10/data/pg_hba.conf &&\
306
70592a18c5c6 Keep log on stderr to be able to use docker logs
Tom Gottfried <tom@intevation.de>
parents: 246
diff changeset
23 echo "listen_addresses='*'" >> $PGCONF &&\
70592a18c5c6 Keep log on stderr to be able to use docker logs
Tom Gottfried <tom@intevation.de>
parents: 246
diff changeset
24 # Keep log on stderr to be able to use docker logs
70592a18c5c6 Keep log on stderr to be able to use docker logs
Tom Gottfried <tom@intevation.de>
parents: 246
diff changeset
25 sed -i '/logging_collector/s/on/off/' $PGCONF
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26 # Expose the PostgreSQL port
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 EXPOSE 5432
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28
116
dad6cf39691e Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 113
diff changeset
29 # Create GEMMA role and database
173
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
30 WORKDIR /opt/gemma
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
31 COPY *.sql *.sh ./
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
32 COPY demo-data ./demo-data/
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
33 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
246
299568ad3c37 Use database setup script for tests and Dockerfile
Tom Gottfried <tom@intevation.de>
parents: 211
diff changeset
34 ./install-db.sh --demo && \
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35 $PGBIN/pg_ctl stop -m smart
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
36
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
37 # Set the default command to run when starting the container
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
38 CMD ["/usr/pgsql-10/bin/postgres", "-D", "/var/lib/pgsql/10/data"]