kopia lustrzana https://github.com/kartoza/docker-postgis
Upgraded to PG 10
rodzic
791f21005b
commit
538dc71933
|
@ -18,7 +18,7 @@ RUN apt-get -y update
|
||||||
# We add postgis as well to prevent build errors (that we dont see on local builds)
|
# We add postgis as well to prevent build errors (that we dont see on local builds)
|
||||||
# on docker hub e.g.
|
# on docker hub e.g.
|
||||||
# The following packages have unmet dependencies:
|
# The following packages have unmet dependencies:
|
||||||
RUN apt-get install -y postgresql-client-9.6 postgresql-common postgresql-9.6 postgresql-9.6-postgis-2.4 postgresql-9.6-pgrouting netcat
|
RUN apt-get install -y postgresql-client-10.0 postgresql-common postgresql-10.0 postgresql-10.0-postgis-2.4 postgresql-10.0-pgrouting netcat
|
||||||
|
|
||||||
# Open port 5432 so linked containers can see them
|
# Open port 5432 so linked containers can see them
|
||||||
EXPOSE 5432
|
EXPOSE 5432
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -1 +1 @@
|
||||||
docker build -t kartoza/postgis:9.6-2.4 .
|
docker build -t kartoza/postgis:10.0-2.4 .
|
||||||
|
|
12
setup.sh
12
setup.sh
|
@ -2,16 +2,16 @@
|
||||||
chmod 600 /etc/ssl/private/ssl-cert-snakeoil.key
|
chmod 600 /etc/ssl/private/ssl-cert-snakeoil.key
|
||||||
|
|
||||||
# These tasks are run as root
|
# These tasks are run as root
|
||||||
CONF="/etc/postgresql/9.6/main/postgresql.conf"
|
CONF="/etc/postgresql/10.0/main/postgresql.conf"
|
||||||
|
|
||||||
# Restrict subnet to docker private network
|
# Restrict subnet to docker private network
|
||||||
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/10.0/main/pg_hba.conf
|
||||||
echo "host all all 172.18.0.0/16 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
echo "host all all 172.18.0.0/16 md5" >> /etc/postgresql/10.0/main/pg_hba.conf
|
||||||
# And allow access from DockerToolbox / Boottodocker on OSX
|
# And allow access from DockerToolbox / Boottodocker on OSX
|
||||||
echo "host all all 192.168.0.0/16 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
echo "host all all 192.168.0.0/16 md5" >> /etc/postgresql/10.0/main/pg_hba.conf
|
||||||
# Listen on all ip addresses
|
# Listen on all ip addresses
|
||||||
echo "listen_addresses = '*'" >> /etc/postgresql/9.6/main/postgresql.conf
|
echo "listen_addresses = '*'" >> /etc/postgresql/10.0/main/postgresql.conf
|
||||||
echo "port = 5432" >> /etc/postgresql/9.6/main/postgresql.conf
|
echo "port = 5432" >> /etc/postgresql/10.0/main/postgresql.conf
|
||||||
|
|
||||||
# Enable ssl
|
# Enable ssl
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
# This script will run as the postgres user due to the Dockerfile USER directive
|
# This script will run as the postgres user due to the Dockerfile USER directive
|
||||||
|
|
||||||
DATADIR="/var/lib/postgresql/9.6/main"
|
DATADIR="/var/lib/postgresql/10.0/main"
|
||||||
CONF="/etc/postgresql/9.6/main/postgresql.conf"
|
CONF="/etc/postgresql/10.0/main/postgresql.conf"
|
||||||
POSTGRES="/usr/lib/postgresql/9.6/bin/postgres"
|
POSTGRES="/usr/lib/postgresql/10.0/bin/postgres"
|
||||||
INITDB="/usr/lib/postgresql/9.6/bin/initdb"
|
INITDB="/usr/lib/postgresql/10.0/bin/initdb"
|
||||||
SQLDIR="/usr/share/postgresql/9.6/contrib/postgis-2.2/"
|
SQLDIR="/usr/share/postgresql/10.0/contrib/postgis-2.2/"
|
||||||
LOCALONLY="-c listen_addresses='127.0.0.1, ::1'"
|
LOCALONLY="-c listen_addresses='127.0.0.1, ::1'"
|
||||||
|
|
||||||
# /etc/ssl/private can't be accessed from within container for some reason
|
# /etc/ssl/private can't be accessed from within container for some reason
|
||||||
|
@ -18,8 +18,8 @@ rm -r /etc/ssl
|
||||||
mv /tmp/ssl-copy /etc/ssl
|
mv /tmp/ssl-copy /etc/ssl
|
||||||
|
|
||||||
# Needed under debian, wasnt needed under ubuntu
|
# Needed under debian, wasnt needed under ubuntu
|
||||||
mkdir -p /var/run/postgresql/9.6-main.pg_stat_tmp
|
mkdir -p /var/run/postgresql/10.0-main.pg_stat_tmp
|
||||||
chmod 0777 /var/run/postgresql/9.6-main.pg_stat_tmp
|
chmod 0777 /var/run/postgresql/10.0-main.pg_stat_tmp
|
||||||
|
|
||||||
# test if DATADIR is existent
|
# test if DATADIR is existent
|
||||||
if [ ! -d $DATADIR ]; then
|
if [ ! -d $DATADIR ]; then
|
||||||
|
@ -71,7 +71,7 @@ fi
|
||||||
# Usage is: docker run [...] -e ALLOW_IP_RANGE='192.168.0.0/16'
|
# Usage is: docker run [...] -e ALLOW_IP_RANGE='192.168.0.0/16'
|
||||||
if [ "$ALLOW_IP_RANGE" ]
|
if [ "$ALLOW_IP_RANGE" ]
|
||||||
then
|
then
|
||||||
echo "host all all $ALLOW_IP_RANGE md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
echo "host all all $ALLOW_IP_RANGE md5" >> /etc/postgresql/10.0/main/pg_hba.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# redirect user/pass into a file so we can echo it into
|
# redirect user/pass into a file so we can echo it into
|
||||||
|
@ -139,11 +139,11 @@ fi
|
||||||
# This should show up in docker logs afterwards
|
# This should show up in docker logs afterwards
|
||||||
su - postgres -c "psql -l"
|
su - postgres -c "psql -l"
|
||||||
|
|
||||||
PID=`cat /var/run/postgresql/9.6-main.pid`
|
PID=`cat /var/run/postgresql/10.0-main.pid`
|
||||||
kill -TERM ${PID}
|
kill -TERM ${PID}
|
||||||
|
|
||||||
# Wait for background postgres main process to exit
|
# Wait for background postgres main process to exit
|
||||||
while [ "$(ls -A /var/run/postgresql/9.6-main.pid 2>/dev/null)" ]; do
|
while [ "$(ls -A /var/run/postgresql/10.0-main.pid 2>/dev/null)" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue