Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 27 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# PostgreSQL GIS stack
#
# This image includes the following tools
# - PostgreSQL 9.5
# - PostGIS 2.2 with raster, topology and sfcgal support
# - PostgreSQL 11
# - PostGIS 2.5.2 with raster, topology and sfcgal support
# - OGR Foreign Data Wrapper
# - PgRouting
# - PDAL master
# - PDAL 1.9.1
# - PostgreSQL PointCloud version master
#
# Version 1.7
# Version 1.8

FROM phusion/baseimage
FROM phusion/baseimage:0.11
MAINTAINER Vincent Picavet, vincent.picavet@oslandia.com

# Set correct environment variables.
Expand All @@ -25,47 +25,42 @@ RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
CMD ["/sbin/my_init"]


RUN apt-get update && apt-get install -y wget ca-certificates
RUN apt-get update && apt-get install -y wget ca-certificates sudo

# Use APT postgresql repositories for 9.5 version
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main 9.5" > /etc/apt/sources.list.d/pgdg.list && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Use APT postgresql repositories for 11 version
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" > /etc/apt/sources.list.d/pgdg.list && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# packages needed for compilation
RUN apt-get update

RUN apt-get install -y autoconf build-essential cmake docbook-mathml docbook-xsl libboost-dev libboost-thread-dev libboost-filesystem-dev libboost-system-dev libboost-iostreams-dev libboost-program-options-dev libboost-timer-dev libcunit1-dev libgdal-dev libgeos++-dev libgeotiff-dev libgmp-dev libjson0-dev libjson-c-dev liblas-dev libmpfr-dev libopenscenegraph-dev libpq-dev libproj-dev libxml2-dev postgresql-server-dev-9.5 xsltproc git build-essential wget
RUN apt-get install -y autoconf build-essential cmake docbook-mathml docbook-xsl libboost-dev libboost-thread-dev libboost-filesystem-dev libboost-system-dev libboost-iostreams-dev libboost-program-options-dev libboost-timer-dev libcunit1-dev libgdal-dev libgeos++-dev libgeotiff-dev libgmp-dev libjson-c-dev liblas-dev libmpfr-dev libopenscenegraph-dev libpq-dev libproj-dev libxml2-dev postgresql-server-dev-11 xsltproc git build-essential wget libzstd-dev

# application packages
RUN apt-get install -y postgresql-9.5
RUN apt-get install -y postgresql-11

# Download and compile CGAL
RUN wget https://gforge.inria.fr/frs/download.php/file/32994/CGAL-4.3.tar.gz &&\
tar -xzf CGAL-4.3.tar.gz &&\
cd CGAL-4.3 &&\
RUN wget https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.13.1/CGAL-4.13.1.tar.xz &&\
tar -xf CGAL-4.13.1.tar.xz &&\
cd CGAL-4.13.1 &&\
mkdir build && cd build &&\
cmake .. &&\
make -j3 && make install
# cleanup
RUN rm -Rf CGAL-4.13.1.tar.xz CGAL-4.13.1

# download and compile SFCGAL
RUN git clone https://github.com/Oslandia/SFCGAL.git
RUN cd SFCGAL && cmake . && make -j3 && make install
# cleanup
RUN rm -Rf SFCGAL

# download and install GEOS 3.5
RUN wget http://download.osgeo.org/geos/geos-3.5.0.tar.bz2 &&\
tar -xjf geos-3.5.0.tar.bz2 &&\
cd geos-3.5.0 &&\
./configure && make && make install &&\
cd .. && rm -Rf geos-3.5.0 geos-3.5.0.tar.bz2

# Download and compile PostGIS
RUN wget http://download.osgeo.org/postgis/source/postgis-2.2.0.tar.gz
RUN tar -xzf postgis-2.2.0.tar.gz
RUN cd postgis-2.2.0 && ./configure --with-sfcgal=/usr/local/bin/sfcgal-config --with-geos=/usr/local/bin/geos-config
RUN cd postgis-2.2.0 && make && make install
RUN wget http://download.osgeo.org/postgis/source/postgis-2.5.2.tar.gz
RUN tar -xzf postgis-2.5.2.tar.gz
RUN cd postgis-2.5.2 && ./configure --with-sfcgal=/usr/local/bin/sfcgal-config
RUN cd postgis-2.5.2 && make && make install
# cleanup
RUN rm -Rf postgis-2.2.0.tar.gz postgis-2.2.0
RUN rm -Rf postgis-2.5.2.tar.gz postgis-2.5.2

# Download and compile pgrouting
RUN git clone https://github.com/pgRouting/pgrouting.git &&\
Expand All @@ -83,7 +78,9 @@ RUN git clone https://github.com/pramsey/pgsql-ogr-fdw.git &&\
cd .. && rm -Rf pgsql-ogr-fdw

# Compile PDAL
RUN git clone https://github.com/PDAL/PDAL.git pdal
RUN git clone https://github.com/PDAL/PDAL.git pdal && \
cd pdal && \
git checkout 1.9.1
RUN mkdir PDAL-build && \
cd PDAL-build && \
cmake ../pdal && \
Expand All @@ -104,10 +101,10 @@ RUN ldconfig
# clean packages

# all -dev packages
RUN apt-get remove -y --purge autotools-dev libgeos-dev libgif-dev libgl1-mesa-dev libglu1-mesa-dev libgnutls-dev libgpg-error-dev libhdf4-alt-dev libhdf5-dev libicu-dev libidn11-dev libjasper-dev libjbig-dev libjpeg8-dev libjpeg-dev libjpeg-turbo8-dev libkrb5-dev libldap2-dev libltdl-dev liblzma-dev libmysqlclient-dev libnetcdf-dev libopenthreads-dev libp11-kit-dev libpng12-dev libpthread-stubs0-dev librtmp-dev libspatialite-dev libsqlite3-dev libssl-dev libstdc++-4.8-dev libtasn1-6-dev libtiff5-dev libwebp-dev libx11-dev libx11-xcb-dev libxau-dev libxcb1-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxdmcp-dev libxerces-c-dev libxext-dev libxfixes-dev libxshmfence-dev libxxf86vm-dev linux-libc-dev manpages-dev mesa-common-dev libgcrypt11-dev unixodbc-dev uuid-dev x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev x11proto-xf86vidmode-dev xtrans-dev zlib1g-dev
RUN apt-get remove -y --purge autotools-dev libgeos-dev libgif-dev libgl1-mesa-dev libglu1-mesa-dev libgnutls-dev libgpg-error-dev libhdf4-alt-dev libhdf5-dev libicu-dev libidn11-dev libjbig-dev libjpeg8-dev libjpeg-dev libjpeg-turbo8-dev libkrb5-dev libldap2-dev libltdl-dev liblzma-dev libmysqlclient-dev libnetcdf-dev libopenthreads-dev libp11-kit-dev libpng12-dev libpthread-stubs0-dev librtmp-dev libspatialite-dev libsqlite3-dev libssl-dev libstdc++-4.8-dev libtasn1-6-dev libtiff5-dev libwebp-dev libx11-dev libx11-xcb-dev libxau-dev libxcb1-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxdmcp-dev libxerces-c-dev libxext-dev libxfixes-dev libxshmfence-dev libxxf86vm-dev linux-libc-dev manpages-dev mesa-common-dev libgcrypt11-dev unixodbc-dev uuid-dev x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev x11proto-xf86vidmode-dev xtrans-dev zlib1g-dev libzstd-dev

# installed packages
RUN apt-get remove -y --purge autoconf build-essential cmake docbook-mathml docbook-xsl libboost-dev libboost-filesystem-dev libboost-timer-dev libcgal-dev libcunit1-dev libgdal-dev libgeos++-dev libgeotiff-dev libgmp-dev libjson0-dev libjson-c-dev liblas-dev libmpfr-dev libopenscenegraph-dev libpq-dev libproj-dev libxml2-dev postgresql-server-dev-9.5 xsltproc git build-essential wget
RUN apt-get remove -y --purge autoconf build-essential cmake docbook-mathml docbook-xsl libboost-dev libboost-filesystem-dev libboost-timer-dev libcgal-dev libcunit1-dev libgdal-dev libgeos++-dev libgeotiff-dev libgmp-dev libjson-c-dev liblas-dev libmpfr-dev libopenscenegraph-dev libpq-dev libproj-dev libxml2-dev postgresql-server-dev-9.5 xsltproc git build-essential wget

# additional compilation packages
RUN apt-get remove -y --purge automake m4 make
Expand All @@ -120,10 +117,10 @@ ADD postgresql.sh /etc/service/postgresql/run

# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/11/main/pg_hba.conf

# And add ``listen_addresses`` to ``/etc/postgresql/9.5/main/postgresql.conf``
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/11/main/postgresql.conf

# Expose PostgreSQL
EXPOSE 5432
Expand Down
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
NEWS items
==========

07/08/19 - Release 1.8
* Upgrade to Phusion 0.11 ( Ubuntu Bionic )
* Upgrade PDAL to 1.9.1
* Upgrade PostgreSQL to 11
* Upgrade PostGIS to 2.5.2
* Upgrade PGRouting to master
* Upgrade PgPointCloud to master

28/10/15 - Release 1.7
* Upgrade PostGIS to 2.2
* Upgrade GEOS from source to 3.5
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Presentation
------------

This Docker image is a container with all latest PostgreSQL extensions needed to do serious GIS work.
It is based on Ubuntu 14.04 and features :
It is based on Ubuntu 18.04 and features :

* PostgreSQL 9.5 (from PGDG packages)
* PostGIS 2.2 (compiled from release sources) with SFCGAL support (git master) and GEOS 3.5
* PostgreSQL 11 (from PGDG packages)
* PostGIS 2.5.2 (compiled from release sources) with SFCGAL support (git master)
* PgRouting (git master)
* PostgreSQL PointCloud extension (git master)
* OGR Foreign data wrapper (Git master)
Expand All @@ -22,7 +22,7 @@ This Docker is aimed at tests and development. Do not use it for production purp
Just get me started !
---------------------

Make sure you have docker installed. On Ubuntu 14.04, Docker is named *docker.io*, replace the *docker* by *docker.io* in the following if needed. It is advised to use the latest available Docker version from official packages. See : https://blog.docker.com/2015/07/new-apt-and-yum-repos/
Make sure you have docker installed. It is advised to use the latest available Docker version from official packages. See : https://blog.docker.com/2015/07/new-apt-and-yum-repos/

If you just want to run a container with this image, you do not need this repository as the image is available on docker hub as a Trusted Build.
Just run the container and it will download the image if you do not already have it locally :
Expand Down Expand Up @@ -104,7 +104,7 @@ Known problems

When using Docker with AUFS, you can hit bug #783, and PostgreSQL server cannot be started due to permission problems. You will see dots appearing on the screen forever. There are at least three alternatives to workaround this bug :

* Wait until the AUFS fix is released and taken into account in Docker ( not released yet as of feb. 2015 )
* Wait until the AUFS fix is released and taken into account in Docker ( should be fixed as of kernel 4.4.6 )

* Remove containers and images related to this project and rebuild the image from scratch :

Expand All @@ -129,7 +129,7 @@ References
==========

More complete documentation on Oslandia's blog post :
http://www.oslandia.com/full-spatial-database-power-in-2-lines-en.html
https://oslandia.com/2014/05/20/full-spatial-database-power-in-2-lines/

Dockerfile reference :
http://docs.docker.io/reference/builder/
Expand Down
2 changes: 1 addition & 1 deletion postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# `/sbin/setuser postgres` runs the given command as the user `postgres`.
# If you omit that part, the command will be run as root.
rm -rf /etc/ssl/private-copy; mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private
exec /sbin/setuser postgres /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf >> /var/log/postgresql.log 2>&1
exec /sbin/setuser postgres /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/main -c config_file=/etc/postgresql/11/main/postgresql.conf >> /var/log/postgresql.log 2>&1