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