kopia lustrzana https://github.com/kartoza/docker-postgis
Switch to using debian base image and pg 9.4
rodzic
8e0614a6c0
commit
8e0ca93712
|
@ -1,5 +1,5 @@
|
||||||
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
|
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
|
||||||
FROM ubuntu:14.04
|
FROM debian:stable
|
||||||
MAINTAINER Tim Sutton<tim@kartoza.com>
|
MAINTAINER Tim Sutton<tim@kartoza.com>
|
||||||
|
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive
|
RUN export DEBIAN_FRONTEND=noninteractive
|
||||||
|
@ -12,7 +12,7 @@ RUN dpkg-divert --local --rename --add /sbin/initctl
|
||||||
# Or comment this line out if you do not with to use caching
|
# Or comment this line out if you do not with to use caching
|
||||||
ADD 71-apt-cacher-ng /etc/apt/apt.conf.d/71-apt-cacher-ng
|
ADD 71-apt-cacher-ng /etc/apt/apt.conf.d/71-apt-cacher-ng
|
||||||
|
|
||||||
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
|
#RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
|
||||||
RUN apt-get -y update
|
RUN apt-get -y update
|
||||||
RUN apt-get -y install ca-certificates rpl pwgen
|
RUN apt-get -y install ca-certificates rpl pwgen
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ RUN apt-get -y install ca-certificates rpl pwgen
|
||||||
# The following packages have unmet dependencies:
|
# The following packages have unmet dependencies:
|
||||||
# postgresql-9.3-postgis-2.1 : Depends: libgdal1h (>= 1.9.0) but it is not going to be installed
|
# postgresql-9.3-postgis-2.1 : Depends: libgdal1h (>= 1.9.0) but it is not going to be installed
|
||||||
# Recommends: postgis but it is not going to be installed
|
# Recommends: postgis but it is not going to be installed
|
||||||
RUN apt-get install -y postgresql-9.3-postgis-2.1 postgis libgdal1h
|
RUN apt-get install -y postgresql-9.4-postgis-2.1 postgis
|
||||||
ADD postgres.conf /etc/supervisor/conf.d/postgres.conf
|
ADD postgres.conf /etc/supervisor/conf.d/postgres.conf
|
||||||
|
|
||||||
# Open port 5432 so linked containers can see them
|
# Open port 5432 so linked containers can see them
|
||||||
|
|
8
setup.sh
8
setup.sh
|
@ -1,13 +1,13 @@
|
||||||
# Add any additional setup tasks here
|
# Add any additional setup tasks here
|
||||||
|
|
||||||
# These tasks are run as root
|
# These tasks are run as root
|
||||||
CONF="/etc/postgresql/9.3/main/postgresql.conf"
|
CONF="/etc/postgresql/9.4/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.3/main/pg_hba.conf
|
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.4/main/pg_hba.conf
|
||||||
# Listen on all ip addresses
|
# Listen on all ip addresses
|
||||||
echo "listen_addresses = '*'" >> /etc/postgresql/9.3/main/postgresql.conf
|
echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf
|
||||||
echo "port = 5432" >> /etc/postgresql/9.3/main/postgresql.conf
|
echo "port = 5432" >> /etc/postgresql/9.4/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.3/main"
|
DATADIR="/var/lib/postgresql/9.4/main"
|
||||||
CONF="/etc/postgresql/9.3/main/postgresql.conf"
|
CONF="/etc/postgresql/9.4/main/postgresql.conf"
|
||||||
POSTGRES="/usr/lib/postgresql/9.3/bin/postgres"
|
POSTGRES="/usr/lib/postgresql/9.4/bin/postgres"
|
||||||
INITDB="/usr/lib/postgresql/9.3/bin/initdb"
|
INITDB="/usr/lib/postgresql/9.4/bin/initdb"
|
||||||
SQLDIR="/usr/share/postgresql/9.3/contrib/postgis-2.1/"
|
SQLDIR="/usr/share/postgresql/9.4/contrib/postgis-2.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
|
||||||
# (@andrewgodwin says it's something AUFS related) - taken from https://github.com/orchardup/docker-postgresql/blob/master/Dockerfile
|
# (@andrewgodwin says it's something AUFS related) - taken from https://github.com/orchardup/docker-postgresql/blob/master/Dockerfile
|
||||||
|
@ -16,6 +16,9 @@ chown -R postgres /tmp/ssl-copy
|
||||||
rm -r /etc/ssl
|
rm -r /etc/ssl
|
||||||
mv /tmp/ssl-copy /etc/ssl
|
mv /tmp/ssl-copy /etc/ssl
|
||||||
|
|
||||||
|
# Needed under debian, wasnt needed under ubuntu
|
||||||
|
mkdir /var/run/postgresql/9.4-main.pg_stat_tmp
|
||||||
|
chmod 0777 /var/run/postgresql/9.4-main.pg_stat_tmp
|
||||||
|
|
||||||
# test if DATADIR is existent
|
# test if DATADIR is existent
|
||||||
if [ ! -d $DATADIR ]; then
|
if [ ! -d $DATADIR ]; then
|
||||||
|
@ -120,7 +123,7 @@ 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.3-main.pid`
|
PID=`cat /var/run/postgresql/9.4-main.pid`
|
||||||
kill -9 ${PID}
|
kill -9 ${PID}
|
||||||
echo "Postgres initialisation process completed .... restarting in foreground"
|
echo "Postgres initialisation process completed .... restarting in foreground"
|
||||||
su - postgres -c "$POSTGRES -D $DATADIR -c config_file=$CONF"
|
su - postgres -c "$POSTGRES -D $DATADIR -c config_file=$CONF"
|
||||||
|
|
Ładowanie…
Reference in New Issue