-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
35 lines (26 loc) · 1.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# VERSION 0.0.0
# DOCKER-VERSION 0.8.0
FROM stackbrew/ubuntu:precise
MAINTAINER Gabriel Farrell [email protected]
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes postgresql inotify-tools
# Create default user super/pass
RUN su postgres -c '/usr/lib/postgresql/9.1/bin/postgres -D /etc/postgresql/9.1/main' & \
inotifywait -e create /run/postgresql && \
su postgres -c "echo \"CREATE ROLE super WITH ENCRYPTED PASSWORD 'pass'; ALTER ROLE super WITH SUPERUSER; ALTER ROLE super WITH LOGIN;\" | psql" && \
kill `cat /run/postgresql/9.1-main.pid` && \
inotifywait -e delete /run/postgresql
# Configure the database to use our data dir
RUN sed -i -e"s/data_directory =.*$/data_directory = '\/data'/" /etc/postgresql/9.1/main/postgresql.conf
# Allow connections from anywhere.
RUN sed -i -e"s/^#listen_addresses =.*$/listen_addresses = '*'/" /etc/postgresql/9.1/main/postgresql.conf
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.1/main/pg_hba.conf
ADD start.sh start.sh
RUN chmod +x start.sh
CMD ["/start.sh"]
# Store data persistently on the host
VOLUME ["/data"]
EXPOSE 5432