Skip to content
This repository was archived by the owner on May 19, 2020. It is now read-only.

Use Postgres 12 and PostGIS 3.0.0 from upstream #14

Closed
Closed
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
162 changes: 53 additions & 109 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,112 +1,56 @@
FROM postgres:9.6
ARG POSTGRES_MAJOR=12
ARG POSTGIS_MAJOR=3
ARG OSML10N_VER=2.5.7

FROM postgres:${POSTGRES_MAJOR} AS builder

ARG POSTGRES_MAJOR
ARG POSTGIS_MAJOR
ARG OSML10N_VER

USER root

# Compile mapnik
RUN apt-get update \
&& apt-get install -y postgresql-server-dev-${POSTGRES_MAJOR} devscripts equivs git

ADD https://github.com/giggls/mapnik-german-l10n/archive/v${OSML10N_VER}.tar.gz /tmp/mapnik-german-l10n.tar.gz

RUN cd /tmp \
&& tar xvf mapnik-german-l10n.tar.gz \
&& cd mapnik-german-l10n-${OSML10N_VER} \
&& cat debian/control \
&& DEBIAN_FRONTEND=noninteractive mk-build-deps -ir -t "apt-get -qq --no-install-recommends" debian/control \
&& PG_SUPPORTED_VERSIONS=${POSTGRES_MAJOR} make deb

# Build gdal with PG 12 support (https://github.com/OSGeo/gdal/commit/963618e77de4eee5e7321f5f5ca7abc2b7287fa2)
WORKDIR /tmp/build

RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list

RUN apt-get update && apt -y build-dep gdal-bin
RUN git clone --single-branch --branch release/2.4 https://github.com/OSGeo/gdal.git
RUN cd gdal && git checkout 963618e77de4eee5e7321f5f5ca7abc2b7287fa2
RUN cd gdal/gdal && ls && ./configure && make && make install DESTDIR=/tmp/gdal

RUN mkdir /tmp/deb && \
mv /tmp/postgresql-${POSTGRES_MAJOR}-osml10n_${OSML10N_VER}_$(dpkg --print-architecture).deb \
/tmp/deb

FROM postgres:${POSTGRES_MAJOR}

MAINTAINER "Lukas Martinelli <[email protected]>"
ENV POSTGIS_MAJOR=2.4dev \
POSTGIS_VERSION=2.4dev \
GEOS_VERSION=3.6.0

RUN apt-get -qq -y update \
&& apt-get -qq -y --no-install-recommends install \
autoconf \
automake \
autotools-dev \
build-essential \
ca-certificates \
bison \
cmake \
curl \
dblatex \
docbook-mathml \
docbook-xsl \
git \
gdal-bin \
libcunit1-dev \
libkakasi2-dev \
libtool \
pandoc \
unzip \
xsltproc \
# PostGIS build dependencies
libgdal-dev \
libjson0-dev \
libproj-dev \
libxml2-dev \
postgresql-server-dev-$PG_MAJOR \
## GEOS
&& cd /opt/ \
&& curl -o /opt/geos.tar.bz2 http://download.osgeo.org/geos/geos-$GEOS_VERSION.tar.bz2 \
&& mkdir /opt/geos \
&& tar xf /opt/geos.tar.bz2 -C /opt/geos --strip-components=1 \
&& cd /opt/geos/ \
&& ./configure \
&& make -j \
&& make install \
&& rm -rf /opt/geos* \
## Protobuf
&& cd /opt/ \
&& curl -L https://github.com/google/protobuf/archive/v3.0.2.tar.gz | tar xvz && cd protobuf-3.0.2 \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /opt/protobuf-3.0.2 \
## Protobuf-c
&& cd /opt/ \
&& curl -L https://github.com/protobuf-c/protobuf-c/releases/download/v1.2.1/protobuf-c-1.2.1.tar.gz | tar xvz && cd protobuf-c-1.2.1 \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /opt/protobuf-c.1.2.1 \
## Postgis
&& cd /opt/ \
&& git clone -b svn-trunk https://github.com/postgis/postgis.git \
&& cd postgis \
&& git reset --hard ff0a844e606622f45841fc25221bbaa136ed1001 \
&& ./autogen.sh \
&& ./configure CFLAGS="-O0 -Wall" \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /opt/postgis \
## UTF8Proc
&& cd /opt/ \
&& git clone https://github.com/JuliaLang/utf8proc.git \
&& cd utf8proc \
&& git checkout -q v2.0.2 \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /opt/utf8proc \
## Mapnik German
&& cd /opt/ \
&& git clone https://github.com/openmaptiles/mapnik-german-l10n.git \
&& cd mapnik-german-l10n \
&& make \
&& make install \
&& rm -rf /opt/mapnik-german-l10n \
## Cleanup
&& apt-get -qq -y --auto-remove purge \
autoconf \
automake \
autotools-dev \
build-essential \
ca-certificates \
bison \
cmake \
curl \
dblatex \
docbook-mathml \
docbook-xsl \
git \
libcunit1-dev \
libtool \
make \
g++ \
gcc \
pandoc \
unzip \
xsltproc \
&& rm -rf /var/lib/apt/lists/*

ARG POSTGRES_MAJOR
ARG POSTGIS_MAJOR
ARG OSML10N_VER=2.5.7

COPY --from=builder /tmp/deb /tmp/deb
COPY --from=builder /tmp/gdal/ /
RUN apt-get update \
&& apt-get install -y postgresql-${POSTGRES_MAJOR}-postgis-${POSTGIS_MAJOR} /tmp/deb/* \
&& rm -rf /var/lib/apt/lists/*

ENV PROJSO libproj.so.13

COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PostgreSQL with GEOS 3.6.0 and PostGIS 2.4dev
# PostgreSQL 12 with PostGIS 3.0.0
[![](https://images.microbadger.com/badges/image/openmaptiles/postgis.svg)](https://microbadger.com/images/openmaptiles/postgis "Get your own image badge on microbadger.com") [![Docker Automated buil](https://img.shields.io/docker/automated/openmaptiles/postgis.svg)]()

A custom PostgreSQL Docker image based off GEOS 3.6.0 and PostGIS 2.3.1.
A custom PostgreSQL Docker image based off PostgreSQL 12 and PostGIS 3.0.0

## Usage

Expand Down