kopia lustrzana https://github.com/kartoza/docker-postgis
Allow bash script for entrypoint initialization
rodzic
96b31e80bd
commit
3cb5ec40bb
|
@ -9,9 +9,9 @@ RUN export DEBIAN_FRONTEND=noninteractive
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
RUN dpkg-divert --local --rename --add /sbin/initctl
|
RUN dpkg-divert --local --rename --add /sbin/initctl
|
||||||
|
|
||||||
RUN apt-get -y update; apt-get -y install gnupg2 wget ca-certificates rpl pwgen gdal-bin
|
RUN apt-get -y update; apt-get -y install gnupg2 wget ca-certificates rpl pwgen software-properties-common gdal-bin
|
||||||
|
|
||||||
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
RUN sh -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -c -s)-pgdg main\" > /etc/apt/sources.list.d/pgdg.list"
|
||||||
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add -
|
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add -
|
||||||
|
|
||||||
#-------------Application Specific Stuff ----------------------------------------------------
|
#-------------Application Specific Stuff ----------------------------------------------------
|
||||||
|
|
|
@ -32,6 +32,7 @@ else
|
||||||
case "$f" in
|
case "$f" in
|
||||||
*.sql) echo "$0: running $f"; psql ${SINGLE_DB} -U ${POSTGRES_USER} -p 5432 -h localhost -f ${f} || true ;;
|
*.sql) echo "$0: running $f"; psql ${SINGLE_DB} -U ${POSTGRES_USER} -p 5432 -h localhost -f ${f} || true ;;
|
||||||
*.sql.gz) echo "$0: running $f"; gunzip < "$f" | psql ${SINGLE_DB} -U ${POSTGRES_USER} -p 5432 -h localhost || true ;;
|
*.sql.gz) echo "$0: running $f"; gunzip < "$f" | psql ${SINGLE_DB} -U ${POSTGRES_USER} -p 5432 -h localhost || true ;;
|
||||||
|
*.sh) echo "$0: running $f"; . $f || true;;
|
||||||
*) echo "$0: ignoring $f" ;;
|
*) echo "$0: ignoring $f" ;;
|
||||||
esac
|
esac
|
||||||
echo
|
echo
|
||||||
|
|
22
env-data.sh
22
env-data.sh
|
@ -144,3 +144,25 @@ fi
|
||||||
if [ ! -z "$POSTGRES_DB" ]; then
|
if [ ! -z "$POSTGRES_DB" ]; then
|
||||||
POSTGRES_DBNAME=${POSTGRES_DB}
|
POSTGRES_DBNAME=${POSTGRES_DB}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# usable function definitions
|
||||||
|
function restart_postgres {
|
||||||
|
PID=`cat ${PG_PID}`
|
||||||
|
kill -TERM ${PID}
|
||||||
|
|
||||||
|
# Wait for background postgres main process to exit
|
||||||
|
while [[ "$(ls -A ${PG_PID} 2>/dev/null)" ]]; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Brought postgres back up again
|
||||||
|
source /env-data.sh
|
||||||
|
su - postgres -c "${POSTGRES} -D ${DATADIR} -c config_file=${CONF} ${LOCALONLY} &"
|
||||||
|
|
||||||
|
# wait for postgres to come up
|
||||||
|
until su - postgres -c "psql -l"; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "postgres ready"
|
||||||
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue