kopia lustrzana https://github.com/kartoza/docker-postgis
Updated to 9.6 and postgis 2.4
rodzic
6b830d35d9
commit
9987840ec4
15
Dockerfile
15
Dockerfile
|
@ -7,23 +7,18 @@ ENV DEBIAN_FRONTEND noninteractive
|
|||
RUN dpkg-divert --local --rename --add /sbin/initctl
|
||||
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install gnupg
|
||||
#RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
|
||||
# Add the PostgreSQL PGP key to verify their Debian packages.
|
||||
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||
# Add PostgreSQL's repository. It contains the most recent stable release
|
||||
# of PostgreSQL, ``9.5``.
|
||||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
RUN apt-get -y install gnupg2 wget ca-certificates rpl pwgen
|
||||
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install ca-certificates rpl pwgen
|
||||
#RUN apt-get -y upgrade
|
||||
|
||||
#-------------Application Specific Stuff ----------------------------------------------------
|
||||
|
||||
# We add postgis as well to prevent build errors (that we dont see on local builds)
|
||||
# on docker hub e.g.
|
||||
# The following packages have unmet dependencies:
|
||||
RUN apt-get install -y postgresql-9.5-postgis-2.2
|
||||
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
|
||||
|
||||
# Open port 5432 so linked containers can see them
|
||||
EXPOSE 5432
|
||||
|
|
2
build.sh
2
build.sh
|
@ -1 +1 @@
|
|||
docker build -t kartoza/postgis:9.5-2.2 .
|
||||
docker build -t kartoza/postgis:9.6-2.4 .
|
||||
|
|
12
setup.sh
12
setup.sh
|
@ -2,16 +2,16 @@
|
|||
chmod 600 /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
|
||||
# These tasks are run as root
|
||||
CONF="/etc/postgresql/9.5/main/postgresql.conf"
|
||||
CONF="/etc/postgresql/9.6/main/postgresql.conf"
|
||||
|
||||
# Restrict subnet to docker private network
|
||||
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
|
||||
echo "host all all 172.18.0.0/16 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
|
||||
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
||||
echo "host all all 172.18.0.0/16 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
||||
# And allow access from DockerToolbox / Boottodocker on OSX
|
||||
echo "host all all 192.168.0.0/16 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
|
||||
echo "host all all 192.168.0.0/16 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
||||
# Listen on all ip addresses
|
||||
echo "listen_addresses = '*'" >> /etc/postgresql/9.5/main/postgresql.conf
|
||||
echo "port = 5432" >> /etc/postgresql/9.5/main/postgresql.conf
|
||||
echo "listen_addresses = '*'" >> /etc/postgresql/9.6/main/postgresql.conf
|
||||
echo "port = 5432" >> /etc/postgresql/9.6/main/postgresql.conf
|
||||
|
||||
# Enable ssl
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
# This script will run as the postgres user due to the Dockerfile USER directive
|
||||
|
||||
DATADIR="/var/lib/postgresql/9.5/main"
|
||||
CONF="/etc/postgresql/9.5/main/postgresql.conf"
|
||||
POSTGRES="/usr/lib/postgresql/9.5/bin/postgres"
|
||||
INITDB="/usr/lib/postgresql/9.5/bin/initdb"
|
||||
SQLDIR="/usr/share/postgresql/9.5/contrib/postgis-2.2/"
|
||||
DATADIR="/var/lib/postgresql/9.6/main"
|
||||
CONF="/etc/postgresql/9.6/main/postgresql.conf"
|
||||
POSTGRES="/usr/lib/postgresql/9.6/bin/postgres"
|
||||
INITDB="/usr/lib/postgresql/9.6/bin/initdb"
|
||||
SQLDIR="/usr/share/postgresql/9.6/contrib/postgis-2.2/"
|
||||
LOCALONLY="-c listen_addresses='127.0.0.1, ::1'"
|
||||
|
||||
# /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
|
||||
|
||||
# Needed under debian, wasnt needed under ubuntu
|
||||
mkdir -p /var/run/postgresql/9.5-main.pg_stat_tmp
|
||||
chmod 0777 /var/run/postgresql/9.5-main.pg_stat_tmp
|
||||
mkdir -p /var/run/postgresql/9.6-main.pg_stat_tmp
|
||||
chmod 0777 /var/run/postgresql/9.6-main.pg_stat_tmp
|
||||
|
||||
# test if DATADIR is existent
|
||||
if [ ! -d $DATADIR ]; then
|
||||
|
@ -71,7 +71,7 @@ fi
|
|||
# Usage is: docker run [...] -e ALLOW_IP_RANGE='192.168.0.0/16'
|
||||
if [ "$ALLOW_IP_RANGE" ]
|
||||
then
|
||||
echo "host all all $ALLOW_IP_RANGE md5" >> /etc/postgresql/9.5/main/pg_hba.conf
|
||||
echo "host all all $ALLOW_IP_RANGE md5" >> /etc/postgresql/9.6/main/pg_hba.conf
|
||||
fi
|
||||
|
||||
# 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
|
||||
su - postgres -c "psql -l"
|
||||
|
||||
PID=`cat /var/run/postgresql/9.5-main.pid`
|
||||
PID=`cat /var/run/postgresql/9.6-main.pid`
|
||||
kill -TERM ${PID}
|
||||
|
||||
# Wait for background postgres main process to exit
|
||||
while [ "$(ls -A /var/run/postgresql/9.5-main.pid 2>/dev/null)" ]; do
|
||||
while [ "$(ls -A /var/run/postgresql/9.6-main.pid 2>/dev/null)" ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue