Mercurial > gemma
annotate schema/Dockerfile @ 156:4ade330e571e
refactor: Refactor Dockerfile to reflect changes
Tighten the run commands to streamline container build
Include actual demousers.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 03 Jul 2018 11:40:16 +0200 |
parents | dad6cf39691e |
children | a85c44438d48 |
rev | line source |
---|---|
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 FROM centos:7 |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 MAINTAINER tom.gottfried@intevation.de |
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 &&\ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 # Add PostgreSQL's repository. It contains the most recent release |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
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 &&\ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
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 &&\ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 # Adjust PostgreSQL configuration so that remote connections to the |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
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 |
156
4ade330e571e
refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents:
116
diff
changeset
|
28 COPY *.sql ./ |
4ade330e571e
refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents:
116
diff
changeset
|
29 COPY demo-data/*.sql ./ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
30 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \ |
116
dad6cf39691e
Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
113
diff
changeset
|
31 psql -c "CREATE USER gemma PASSWORD 'gemma'" && \ |
dad6cf39691e
Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
113
diff
changeset
|
32 createdb gemma && \ |
dad6cf39691e
Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
113
diff
changeset
|
33 psql -f gemma.sql -d gemma && \ |
dad6cf39691e
Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
113
diff
changeset
|
34 psql -f auth.sql -d gemma && \ |
156
4ade330e571e
refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents:
116
diff
changeset
|
35 psql -f users.sql -d gemma && \ |
4ade330e571e
refactor: Refactor Dockerfile to reflect changes
Thomas Junk <thomas.junk@intevation.de>
parents:
116
diff
changeset
|
36 psql -f responsibility_areas.sql -d gemma && \ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
37 $PGBIN/pg_ctl stop -m smart |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
38 |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
39 # 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
|
40 CMD ["/usr/pgsql-10/bin/postgres", "-D", "/var/lib/pgsql/10/data"] |