comparison db_schema/Dockerfile @ 743:c7fcc46c6a57

Add Dockerfile for dockerised DB-server.
author Tom Gottfried <tom@intevation.de>
date Mon, 26 Oct 2015 15:49:15 +0100
parents
children 299f4ba86090
comparison
equal deleted inserted replaced
742:17165e710631 743:c7fcc46c6a57
1 # Docker file for postgresql 9.4 on debain
2 #
3 # build with e.g. `docker build --force-rm=true -t koala/lada_db .',
4 # then run with e.g.
5 # `docker run --name lada_db -dp 2345:5432 koala/lada_db:latest'
6 #
7
8 FROM debian:jessie
9 MAINTAINER tom.gottfried@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/lada_sql/
60
61 RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wD /etc/postgresql/9.4/main/ && \
62 /opt/lada_sql/setup-db.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"]
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)