annotate schema/Dockerfile @ 173:2b04de578be0

Use COPY in a way that allows replacing by a volume Before, a volume added as shown in the README actually duplicated the files.
author Tom Gottfried <tom@intevation.de>
date Thu, 12 Jul 2018 17:42:31 +0200
parents a422471db08a
children 0c0826063561
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 &&\
4ade330e571e refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents: 116
diff changeset
23 echo "listen_addresses='*'" >> $PGCONF
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24 # Expose the PostgreSQL port
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25 EXPOSE 5432
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26
116
dad6cf39691e Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 113
diff changeset
27 # 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
28 WORKDIR /opt/gemma
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
29 COPY *.sql *.sh ./
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
30 COPY demo-data ./demo-data/
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
31 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
172
a422471db08a Automate running DB-tests with an extra database
Tom Gottfried <tom@intevation.de>
parents: 157
diff changeset
32 psql -f roles.sql && \
116
dad6cf39691e Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 113
diff changeset
33 createdb gemma && \
dad6cf39691e Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 113
diff changeset
34 psql -f gemma.sql -d gemma && \
dad6cf39691e Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 113
diff changeset
35 psql -f auth.sql -d gemma && \
173
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
36 psql -f demo-data/users.sql -d gemma && \
2b04de578be0 Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents: 172
diff changeset
37 psql -f demo-data/responsibility_areas.sql -d gemma && \
35
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
38 $PGBIN/pg_ctl stop -m smart
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
39
62e14b4d25fc First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
40 # 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
41 CMD ["/usr/pgsql-10/bin/postgres", "-D", "/var/lib/pgsql/10/data"]