comparison backend/doc/schema/Dockerfile @ 8795:13d5b6c67cef

Add Dockerfile for Postgres-DB setup.
author Tom Gottfried <tom@intevation.de>
date Thu, 10 Dec 2015 17:41:27 +0100
parents
children 8927ec8a3c32
comparison
equal deleted inserted replaced
8794:c1cea6c95967 8795:13d5b6c67cef
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:5432 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
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 RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf
46
47 #
48 # Expose the PostgreSQL port
49 #
50 EXPOSE 5432
51
52 #
53 # Create database
54 #
55 # Don't mind scary messages like
56 # 'FATAL: the database system is starting up'.
57 # It's because of the -w
58 #
59 ADD . /opt/d4eriver_db
60
61 RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wD /etc/postgresql/9.4/main/ && \
62 /opt/d4eriver_db/postgresql-setup.sh
63
64 #
65 # Set the default command to run when starting the container
66 #
67 CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", \
68 "/var/lib/postgresql/9.4/main", "-c", \
69 "config_file=/etc/postgresql/9.4/main/postgresql.conf"]

http://dive4elements.wald.intevation.org