Skip to content

Instantly share code, notes, and snippets.

@goindwalia
Last active March 15, 2017 07:12
Show Gist options
  • Save goindwalia/58033a7e9bf13577ecaf1e6a70a0929e to your computer and use it in GitHub Desktop.
Save goindwalia/58033a7e9bf13577ecaf1e6a70a0929e to your computer and use it in GitHub Desktop.
FROM ubuntu:latest
MAINTAINER XenonStack
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER root WITH SUPERUSER PASSWORD 'xenonstack';" &&\
createdb -O root xenonstack
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.6/main/postgresql.conf
# Expose the PostgreSQL port
EXPOSE 5432
# Add VOLUMEs to allow backup of databases
VOLUME ["/var/lib/postgresql"]
# Set the default command to run when starting the container
CMD ["/usr/lib/postgresql/9.6/bin/postgres", "-D", "/var/lib/postgresql", "-c", "config_file=/etc/postgresql/9.6/main/postgresql.conf"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment