comparison backend/doc/schema/Dockerfile @ 9030:4dc047fb3633

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

http://dive4elements.wald.intevation.org