annotate docker/Dockerfile.db @ 9733:93b9034613bc 3.2.x

Skip tests in docker build
author Tom Gottfried <tom@intevation.de>
date Fri, 22 Jul 2022 13:07:07 +0200
parents 13e2d38ad314
children 95496d21b4da
rev   line source
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 # Docker file for postgresql 9.4 on debain
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
3 FROM debian:bullseye
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
4 LABEL maintainer tom.gottfried@intevation.de
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
5
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
6 ENV PG_VERSION 13
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9 # Use utf-8
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 RUN echo \
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | \
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13 debconf-set-selections && \
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 echo "locales locales/default_environment_locale select en_US.UTF-8" | \
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 debconf-set-selections
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 RUN apt-get update -y && apt-get install -y locales
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19 ENV LC_ALL en_US.UTF-8
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22 # Install packages
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 #
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
24 RUN apt-get install -y postgresql-$PG_VERSION-postgis-3 curl
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
25 RUN apt-get -y clean
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
26
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
27 ENV PGCONF /etc/postgresql/$PG_VERSION/main/postgresql.conf
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
28 ENV PGBIN /usr/lib/postgresql/$PG_VERSION/bin/
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
29 ENV PGDATA /var/lib/postgresql/$PG_VERSION/main
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
31 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32 # Use user postgres to run the next commands
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
33 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
34 USER postgres
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
36 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
37 # Adjust PostgreSQL configuration so that remote connections to the
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
38 # database are possible.
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
39 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
40 RUN echo "host all all 0.0.0.0/0 md5" >> \
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
41 /etc/postgresql/$PG_VERSION/main/pg_hba.conf
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
42
8817
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
43 RUN echo "listen_addresses='*'" >> $PGCONF
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
44
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
45 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
46 # Expose the PostgreSQL port
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
47 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
48 EXPOSE 5432
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
49
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
50 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
51 # Create database
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
52 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
53 # Don't mind scary messages like
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
54 # 'FATAL: the database system is starting up'.
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
55 # It's because of the -w
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
56 #
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents: 8817
diff changeset
57 ADD ./backend/doc/schema /opt/d4eriver_db
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
58
8817
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
59 # Go to postgres home for write permissions
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
60 ENV DATA_ARCH demodaten_3.1.10-bis-3.2.x.tar.gz
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
61 RUN curl -sf "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
62 tar -C $HOME --wildcards -xz 'demodaten/*.dump.sql'
8817
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
63
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
64 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
8817
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
65 /opt/d4eriver_db/postgresql-setup.sh && \
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
66 psql -f ~/demodaten/d4e_demodata.dump.sql d4e && \
8817
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
67 createuser -S -D -R seddb && \
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents: 8817
diff changeset
68 psql -c "ALTER USER seddb WITH PASSWORD 'seddb'" && \
8817
8927ec8a3c32 Add demodata and fix server startup in DB Dockerfile.
Tom Gottfried <tom@intevation.de>
parents: 8795
diff changeset
69 createdb seddb && \
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
70 psql -f ~/demodaten/seddb_demodata.dump.sql seddb && \
9684
537fe44f2792 Add basic Docker setup for development
Tom Gottfried <tom@intevation.de>
parents: 8817
diff changeset
71 psql -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO seddb" seddb && \
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
72 $PGBIN/pg_ctl stop -m smart
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
73
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
74 RUN rm -r ~/demodaten
8795
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
75
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
76 #
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
77 # Set the default command to run when starting the container
13d5b6c67cef Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
78 #
9720
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
79 CMD ["/usr/lib/postgresql/13/bin/postgres", "-D", \
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
80 "/var/lib/postgresql/13/main", "-c", \
13e2d38ad314 Improve Docker based setup
Tom Gottfried <tom@intevation.de>
parents: 9716
diff changeset
81 "config_file=/etc/postgresql/13/main/postgresql.conf"]

http://dive4elements.wald.intevation.org