-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.pgrouting.template
executable file
·105 lines (104 loc) · 4.48 KB
/
Dockerfile.pgrouting.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
FROM corpusops/postgis-bare:%%PG_MAJOR%%-%%POSTGIS_MAJOR%% as builder
MAINTAINER kiorky <[email protected]>
RUN bash -euxc ': \
&& apt-get update -qq \
&& apt-get install -y --force-yes build-essential python-twisted-web || true \
&& apt-get install -y --force-yes build-essential cmake \
devscripts equivs lsb-release \
dbconfig-common daemon'
RUN bash -euc ': \
&& apt-get install -y --force-yes \
cmake \
libboost-thread-dev \
libboost-graph-dev \
libcgal-dev \
graphviz \
texlive \
texlive-font-utils \
texlive-latex-extra \
ghostscript \
postgresql-server-dev-all \
# python3-pip python-pip \
# doxygen \
# python3-sphinx \
'
# RUN bash -euc ': \
# && rm /usr/bin/sphinx-build \
# && ln -sfv /usr/local/bin/sphinx-build /usr/bin \
# && python -m pip install "sphinx>1.8" \
# && python3 -m pip install "sphinx>1.8" \
# '
ENV PGROUTING_REPO=%%PGROUTING_REPO%%
ENV PGROUTING_UPSTREAM_REPO=%%PGROUTING_UPSTREAM_REPO%%
RUN bash -euxc ': \
&& apt-get install -y --force-yes \
git \
ca-certificates \
&& git clone $PGROUTING_REPO /usr/src/pgrouting \
&& cd /usr/src/pgrouting \
&& git remote add pgrouting $PGROUTING_UPSTREAM_REPO \
&& git fetch pgrouting \
'
ENV PG_MAJOR=%%PG_MAJOR%%
ENV POSTGRES_MAJOR=%%PG_MAJOR%%
ENV POSTGIS_MAJOR=%%POSTGIS_MAJOR%%
ENV PGROUTING_MAJOR=%%PGROUTING_MAJOR%%
ENV PGROUTING_VERSION=%%PGROUTING_VERSION%%
ENV PGROUTING_DEBIAN_VERSION=%%PGROUTING_DEBIAN_VERSION%%
ENV PGROUTING_UPSTREAM_VERSION=%%PGROUTING_UPSTREAM_VERSION%%
ARG MAKEOPTS=-j4
WORKDIR /usr/src/pgrouting
ADD *.patch.* ../
RUN bash -euxc ': \
&& git reset --hard $PGROUTING_DEBIAN_VERSION \
&& use_upstream="" \
&& if [ "$POSTGRES_MAJOR-$POSTGIS_MAJOR-$PGROUTING_MAJOR" = "11-2.5-2.5" ];then use_upstream="1";fi \
&& if [ "x$use_upstream" = "x1" ];then \
cp -rf debian debian.bak \
&& git reset --hard $(echo $PGROUTING_UPSTREAM_VERSION|sed -re "s/v2.5../v2.5.3/g") \
&& cp -rf debian.bak debian; \
fi \
&& verlte() { [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]; } \
&& : fix https://github.com/pgRouting/pgrouting/issues/963 \
&& if ( verlte $PG_MAJOR 10 ) && ( verlte $PGROUTING_MAJOR 2.4 );then \
bzip2 -ckd ../10.patch.bz2|patch -Np1; \
fi'
RUN bash -euxc ': \
&& echo $PG_MAJOR > ~/.pg_supported_versions \
&& cat ~/.pg_supported_versions \
&& cp debian/control debian/control.bak\
&& cp debian/rules debian/rules.bak\
&& sed -i -r \
-e "s/postgresql-[0-9]+-postgis,/postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR,/g" \
-e "/(python3-sphinx \(>= ).*\)/ d" \
-e "s/postgresql-[0-9]+-/postgresql-$PG_MAJOR/g" \
-e "s/postgis-[0-9]+\.[0-9]+/postgis-$POSTGIS_MAJOR/g" \
-e "s/postgresql-[0-9]+-(pgrouting-scripts)/postgresql-$PG_MAJOR-\1/g" \
-e "s/postgresql-PGVERSION-postgis,/postgresql-PGVERSION-postgis-$POSTGIS_MAJOR, postgresql-PGVERSION-postgis-$POSTGIS_MAJOR-scripts,/g" \
-e "/^Package:.*doc/,$ d" \
debian/control* \
&& : "doc relies on sphinx, which do not built on old debs, in docker we wont need it, disabling." \
&& rm -f debian/postgresql-pgrouting-doc.doc-base.in \
&& sed -i -re "s/ --with sphinxdoc| -DWITH_DOC=ON//g" -e "/sphinx|doc-base|doc\/html|pgrouting-doc/ d" debian/rules \
&& : "rebuild glue" \
&& echo $PG_MAJOR > debian/pgversions \
&& pg_buildext updatecontrol \
&& ( diff -u debian/rules.bak debian/rules ||true )\
&& ( diff -u debian/control.bak debian/control||true )\
&& cat debian/control\
'
RUN mk-build-deps -t "apt-get --no-install-recommends -y --force-yes -o Debug::pkgProblemResolver=yes" -ir debian/control
RUN debuild -i -us -uc -b
FROM corpusops/postgis-bare:%%PG_MAJOR%%-%%POSTGIS_MAJOR%%
MAINTAINER kiorky <[email protected]>
ENV PGROUTING_MAJOR %%PGROUTING_MAJOR%%
ENV PGROUTING_VERSION %%PGROUTING_VERSION%%
COPY --from=builder /usr/src/*deb /tmp/
COPY ./initdb-pgrouting.sh /docker-entrypoint-initdb.d/routing.sh
RUN bash -euxc ': \
&& ls /tmp/*deb \
&& apt-get update \
&& apt install -y --no-install-recommends \
$( ls /tmp/postgresql-$PG_MAJOR-pgrouting*deb -1 | grep -v dbg ) \
&& mkdir -p /docker-entrypoint-initdb.d \
&& rm -rvf /var/lib/apt/lists/* /tmp/*deb'