forked from docker-library/postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Dockerfile installing from http://apt.postgresql.org
- Loading branch information
0 parents
commit e2971da
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM debian:wheezy | ||
|
||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | ||
RUN groupadd -r postgres && useradd -r -g postgres postgres | ||
|
||
RUN apt-get update && apt-get install -y curl | ||
|
||
RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.0/gosu' \ | ||
&& chmod +x /usr/local/bin/gosu | ||
|
||
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' > /etc/apt/sources.list.d/pgdg.list \ | ||
&& curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \ | ||
| apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y postgresql-common \ | ||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \ | ||
&& apt-get install -y postgresql-9.3 | ||
|
||
ENV PATH /usr/lib/postgresql/9.3/bin:$PATH | ||
ENV PGDATA /var/lib/postgresql/data | ||
VOLUME /var/lib/postgresql/data | ||
|
||
ADD ./docker-entrypoint.sh / | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
||
EXPOSE 5432 | ||
CMD ["postgres"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ "$1" = 'postgres' ]; then | ||
chown -R postgres "$PGDATA" | ||
|
||
if [ -z "$(ls -A "$PGDATA")" ]; then | ||
gosu postgres initdb | ||
|
||
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf | ||
|
||
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf | ||
fi | ||
|
||
exec gosu postgres "$@" | ||
fi | ||
|
||
exec "$@" |