annotate backend/doc/schema/Dockerfile @ 9193:f6b7837b89aa

Zusammenführen
author gernotbelger
date Fri, 29 Jun 2018 12:46:17 +0200
parents 4dc047fb3633
children
rev   line source
9030
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
1 # Docker file for postgresql 9.4 on debain
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
2 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
3 # build with e.g. `docker build --force-rm=true -t d4e/river_db .',
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
4 # then run with e.g.
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
5 # `docker run --name d4eriver_db -dp 2345:63333 d4e/river_db:latest'
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
6 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
7
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
8 FROM debian:jessie
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
9 MAINTAINER tom@intevation.de
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
10
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
11 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
12 # Use utf-8
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
13 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
14 RUN echo \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
15 "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
16 debconf-set-selections && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
17 echo "locales locales/default_environment_locale select en_US.UTF-8" | \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
18 debconf-set-selections
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
19
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
20 RUN apt-get update -y && apt-get install -y locales
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
21
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
22 ENV LC_ALL en_US.UTF-8
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
23
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
24 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
25 # Install packages
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
26 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
27 RUN apt-get update && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
28 apt-get install -y postgresql-9.4-postgis-2.1 postgis curl
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
29
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
30 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
31 # Use user postgres to run the next commands
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
32 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
33 USER postgres
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
34
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
35 RUN /etc/init.d/postgresql start && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
36 psql --command "CREATE USER admin WITH SUPERUSER PASSWORD 'secret';"
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
37
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
38 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
39 # Adjust PostgreSQL configuration so that remote connections to the
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
40 # database are possible.
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
41 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
42 RUN echo "host all all 0.0.0.0/0 md5" >> \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
43 /etc/postgresql/9.4/main/pg_hba.conf
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
44
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
45 ENV PGCONF /etc/postgresql/9.4/main/postgresql.conf
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
46 RUN echo "listen_addresses='*'" >> $PGCONF
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
47
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
48 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
49 # Expose the PostgreSQL port
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
50 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
51 EXPOSE 5432
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
52
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
53 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
54 # Create database
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
55 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
56 # Don't mind scary messages like
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
57 # 'FATAL: the database system is starting up'.
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
58 # It's because of the -w
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
59 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
60 ADD . /opt/d4eriver_db
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
61
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
62 # Go to postgres home for write permissions
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
63 WORKDIR /var/lib/postgresql
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
64 ENV DATA_ARCH demodaten_3.1.10-bis-3.2.x.tar.gz
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
65 RUN curl -k "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
66 tar xz
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
67
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
68 ENV PGDATA /var/lib/postgresql/9.4/main
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
69 RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wo "--config_file=$PGCONF" && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
70 /opt/d4eriver_db/postgresql-setup.sh && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
71 psql -f demodaten/d4e_demodata.dump.sql d4e && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
72 createuser -S -D -R seddb && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
73 createdb seddb && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
74 psql -f demodaten/seddb_demodata.dump.sql seddb && \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
75 /usr/lib/postgresql/9.4/bin/pg_ctl stop
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
76
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
77 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
78 # Set the default command to run when starting the container
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
79 #
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
80 CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
81 "/var/lib/postgresql/9.4/main", "-c", \
4dc047fb3633 adding removed files
gernotbelger
parents:
diff changeset
82 "config_file=/etc/postgresql/9.4/main/postgresql.conf"]

http://dive4elements.wald.intevation.org