tom@743: # Docker file for postgresql 9.4 on debain tom@743: # tom@743: # build with e.g. `docker build --force-rm=true -t koala/lada_db .', tom@743: # then run with e.g. tom@743: # `docker run --name lada_db -dp 2345:5432 koala/lada_db:latest' tom@743: # tom@1086: # For easier testing of schema or example data changes, it can be useful to add tom@1086: # `-v $PWD:/opt/lada_sql/' and run setup-db.sh within the container. tom@1086: # tom@743: tom@743: FROM debian:jessie tom@743: MAINTAINER tom.gottfried@intevation.de tom@743: tom@743: # tom@743: # Use utf-8 tom@743: # tom@743: RUN echo \ tom@743: "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | \ tom@743: debconf-set-selections && \ tom@743: echo "locales locales/default_environment_locale select en_US.UTF-8" | \ tom@743: debconf-set-selections tom@743: tom@743: RUN apt-get update -y && apt-get install -y locales tom@743: tom@743: ENV LC_ALL en_US.UTF-8 tom@743: tom@743: # tom@743: # Install packages tom@743: # tom@743: RUN apt-get update && \ mstanko@1056: apt-get install -y postgresql-9.4-postgis-2.1 postgis curl unzip tom@743: tom@743: # tom@743: # Use user postgres to run the next commands tom@743: # tom@743: USER postgres tom@743: tom@743: RUN /etc/init.d/postgresql start && \ tom@743: psql --command "CREATE USER admin WITH SUPERUSER PASSWORD 'secret';" tom@743: tom@743: # tom@743: # Adjust PostgreSQL configuration so that remote connections to the tom@743: # database are possible. tom@743: # tom@743: RUN echo "host all all 0.0.0.0/0 md5" >> \ tom@743: /etc/postgresql/9.4/main/pg_hba.conf tom@743: tom@743: RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf tom@743: tom@743: # tom@743: # Expose the PostgreSQL port tom@743: # tom@743: EXPOSE 5432 tom@743: tom@743: # tom@743: # Create database tom@743: # tom@743: # Don't mind scary messages like tom@743: # 'FATAL: the database system is starting up'. tom@743: # It's because of the -w tom@743: # tom@743: ADD . /opt/lada_sql/ tom@1086: WORKDIR /opt/lada_sql/ tom@743: tom@743: RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wD /etc/postgresql/9.4/main/ && \ tom@743: /opt/lada_sql/setup-db.sh tom@743: tom@743: # tom@743: # Set the default command to run when starting the container tom@743: # tom@743: CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", \ tom@743: "/var/lib/postgresql/9.4/main", "-c", \ tom@743: "config_file=/etc/postgresql/9.4/main/postgresql.conf"]