File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM debian:wheezy
2
+
3
+ # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
4
+ RUN groupadd -r postgres && useradd -r -g postgres postgres
5
+
6
+ RUN apt-get update && apt-get install -y curl
7
+
8
+ RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.0/gosu' \
9
+ && chmod +x /usr/local/bin/gosu
10
+
11
+ RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
12
+ && curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
13
+ | apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764
14
+
15
+ RUN apt-get update \
16
+ && apt-get install -y postgresql-common \
17
+ && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
18
+ && apt-get install -y postgresql-9.3
19
+
20
+ ENV PATH /usr/lib/postgresql/9.3/bin:$PATH
21
+ ENV PGDATA /var/lib/postgresql/data
22
+ VOLUME /var/lib/postgresql/data
23
+
24
+ ADD ./docker-entrypoint.sh /
25
+
26
+ ENTRYPOINT ["/docker-entrypoint.sh" ]
27
+
28
+ EXPOSE 5432
29
+ CMD ["postgres" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -e
3
+
4
+ if [ " $1 " = ' postgres' ]; then
5
+ chown -R postgres " $PGDATA "
6
+
7
+ if [ -z " $( ls -A " $PGDATA " ) " ]; then
8
+ gosu postgres initdb
9
+
10
+ sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
+
12
+ { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
+ fi
14
+
15
+ exec gosu postgres " $@ "
16
+ fi
17
+
18
+ exec " $@ "
You can’t perform that action at this time.
0 commit comments