Mercurial > gemma
annotate docker/Dockerfile.pg @ 5625:39c1698fb0ff
Bumped dev version
author | Sascha Wilde <wilde@sha-bang.de> |
---|---|
date | Thu, 22 Dec 2022 18:43:46 +0100 |
parents | 71f73df1356d |
children |
rev | line source |
---|---|
4165
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 FROM ubuntu:bionic |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 LABEL authors="tom.gottfried@intevation.de" |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 LABEL description="Contains software from gemma, for right holders and\ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 licensing infos, see https://hg.intevation.de/gemma ." |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 ENV DEBIAN_FRONTEND noninteractive |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
7 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
8 RUN apt-get update &&\ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
9 apt-get -y install git make gcc libreadline-dev zlib1g-dev flex bison |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
10 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 # Add PostgreSQL's repository |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 WORKDIR /opt/ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
13 RUN git clone git://git.postgresql.org/git/postgresql.git |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 WORKDIR /opt/postgresql |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 RUN git checkout REL_11_STABLE |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 ENV PGDATA /usr/local/pgsql/data |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
18 ENV PGBIN /usr/local/pgsql/bin |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 ENV PGCONF /usr/local/pgsql/data/postgresql.conf |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 # Install PostgreSQL from sources |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
22 RUN ./configure && make && make install |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
24 # Install PostGIS dependencies |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
25 RUN apt-get -y install autoconf xsltproc \ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
26 libproj-dev libgeos-dev libxml2-dev libjson-c-dev libgdal-dev |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 # Add PostGIS repository and build it |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
29 WORKDIR /opt/ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
30 RUN git clone https://git.osgeo.org/gitea/postgis/postgis.git |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
31 WORKDIR /opt/postgis |
5297
71f73df1356d
Update PostGIS branch name
Tom Gottfried <tom@intevation.de>
parents:
4167
diff
changeset
|
32 RUN git checkout stable-2.5 |
4165
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
33 RUN ./autogen.sh && ./configure --with-pgconfig=$PGBIN/pg_config && \ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
34 make comments && make && make install |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
35 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
36 # Build btree_gist extension |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
37 WORKDIR /opt/postgresql/contrib/btree_gist |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
38 RUN make && make install |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
39 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
40 # Put PostgreSQL executables in path |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
41 ENV PATH $PGBIN:$PATH |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
42 |
4167 | 43 # Add pgTAP repository and build it |
44 WORKDIR /opt | |
45 RUN git clone https://github.com/theory/pgtap.git | |
46 WORKDIR /opt/pgtap | |
47 RUN make && make install | |
48 | |
4165
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
49 # Initialize cluster |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
50 RUN mkdir -p $PGDATA && useradd postgres -d $PGDATA && chown postgres $PGDATA |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
51 USER postgres |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
52 RUN $PGBIN/initdb -D $PGDATA |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
53 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
54 RUN \ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
55 # Adjust PostgreSQL configuration to allow remote connections |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
56 echo "host all all 0.0.0.0/0 md5" \ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
57 >> /usr/local/pgsql/data/pg_hba.conf &&\ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
58 echo "listen_addresses='*'" >> $PGCONF &&\ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
59 # Set port to standard value |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
60 sed -i '/port/s/543./5432/' $PGCONF &&\ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
61 # Keep log on stderr to be able to use docker logs |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
62 sed -i '/logging_collector/s/on/off/' $PGCONF |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
63 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
64 # Expose the PostgreSQL port |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
65 EXPOSE 5432 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
66 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
67 # Create GEMMA role and database |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
68 WORKDIR /opt/gemma |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
69 COPY schema/*.sql schema/*.sh ./ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
70 COPY schema/demo-data ./demo-data/ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
71 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
72 PATH=$PGBIN:$PATH ./install-db.sh --demo --metapw "geo2Serv" && \ |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
73 $PGBIN/pg_ctl stop -m smart |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
74 |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
75 # Set the default command to run when starting the container |
8dd59e2c9d3d
Add Dockerfile for testing with upstream PostgreSQL/PostGIS
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
76 CMD ["/usr/local/pgsql/bin/postgres", "-D", "/usr/local/pgsql/data"] |