From f07a94dc949e53f7371b40a25e977fa460cb8870 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Mon, 30 Apr 2018 18:30:24 +0200 Subject: [PATCH] [ADD]PostgreSQL 8.4 image based on CentOS6 --- postgres/Dockerfile.84 | 41 +++++++++++++ postgres/base.yml | 5 ++ postgres/docker-entrypoint.84.sh | 102 +++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 postgres/Dockerfile.84 create mode 100644 postgres/docker-entrypoint.84.sh diff --git a/postgres/Dockerfile.84 b/postgres/Dockerfile.84 new file mode 100644 index 0000000..2f13607 --- /dev/null +++ b/postgres/Dockerfile.84 @@ -0,0 +1,41 @@ +FROM centos:6 + +MAINTAINER "Kentaro Ohkouchi" +MAINTAINER "Fabien BOURGEOIS" &2 <<-'EOWARN' + **************************************************** + WARNING: No password has been set for the database. + This will allow anyone with access to the + Postgres port to access your database. In + Docker's default configuration, this is + effectively any other container on the same + system. + + Use "-e POSTGRES_PASSWORD=password" to set + it in "docker run". + **************************************************** + EOWARN + + pass= + authMethod=trust + fi + + { echo; echo "host all all 0.0.0.0/0 $authMethod"; } | gosu postgres tee -a "$PGDATA/pg_hba.conf" > /dev/null + + # internal start of server in order to allow set-up using psql-client + # does not listen on external TCP/IP and waits until start finishes + gosu postgres pg_ctl -D "$PGDATA" \ + -o "-c listen_addresses='localhost'" \ + -w start + + : ${POSTGRES_USER:=postgres} + : ${POSTGRES_DB:=$POSTGRES_USER} + export POSTGRES_USER POSTGRES_DB + + psql=( psql -v ON_ERROR_STOP=1 ) + + if [ "$POSTGRES_DB" != 'postgres' ]; then + "${psql[@]}" --username postgres <<-EOSQL + CREATE DATABASE "$POSTGRES_DB" ; + EOSQL + echo + fi + + if [ "$POSTGRES_USER" = 'postgres' ]; then + op='ALTER' + else + op='CREATE' + fi + "${psql[@]}" --username postgres <<-EOSQL + $op USER "$POSTGRES_USER" WITH SUPERUSER $pass ; + EOSQL + echo + + psql+=( --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" ) + + echo + for f in /docker-entrypoint-initdb.d/*; do + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; "${psql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo + done + + gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop + + echo + echo 'PostgreSQL init process complete; ready for start up.' + echo + fi + + exec gosu postgres "$@" +fi + +exec "$@"