FROM boothead/saucy
ENV DEBIAN_FRONTEND noninteractive
# Add repository and install PostgreSQL 9.3
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main 9.3" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y --force-yes -f install postgresql-9.3 postgresql-client-9.3 libicu48 wget
RUN wget http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu//pool/universe/libv/libv8/libv8-3.7.12.22_3.7.12.22-3_amd64.deb
RUN dpkg -i libv8-3.7.12.22_3.7.12.22-3_amd64.deb
RUN apt-get -y --force-yes -f install postgresql-9.3-plv8
# Postgres is started now, shut it down and replace config
RUN service postgresql stop
ADD pg_hba.conf /etc/postgresql/9.3/main/
ADD pg_ident.conf /etc/postgresql/9.3/main/
ADD postgresql.conf /etc/postgresql/9.3/main/
# Create superuser, tempo db and plv8 language
ADD create_user.sh /
RUN /bin/bash /create_user.sh
RUN rm /create_user.sh
# Configure for running in container
EXPOSE 5432
# VOLUME ["/var/lib/postgresql/9.3/main"]
CMD ["/bin/su", "postgres", "-c", "/usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/9.3/main -c config_file=/etc/postgresql/9.3/main/postgresql.conf"]
create_user.sh is basically service postgresql start; su echo <SQL> | psql; service postgresql stop;This is fine for me to spin up a postgres instance at some known state for development, but it's a bit dissatisfying for managing the data separately from the container. Anyone got any tips for integrating volumes with this?