-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Autotools build Dockerfiles (#386)
To make local Autotools build testing easier.
- Loading branch information
1 parent
460efcc
commit 22a13e8
Showing
7 changed files
with
461 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
# Arguments | ||
ARG centos_stream_version | ||
ARG extra_repository | ||
ARG mapnik_version=3.1.0 | ||
|
||
# Mapnik Builder | ||
FROM quay.io/centos/centos:stream${centos_stream_version} as mapnik-builder | ||
|
||
## Arguments | ||
ARG centos_stream_version | ||
ARG extra_repository | ||
ARG mapnik_version | ||
|
||
## Install mapnik-builder dependencies | ||
RUN --mount=id=centos:stream${centos_stream_version}-/var/cache/dnf,target=/var/cache/dnf,type=cache,sharing=locked \ | ||
echo "install_weak_deps=False" >> /etc/dnf/dnf.conf && \ | ||
echo "keepcache=True" >> /etc/dnf/dnf.conf && \ | ||
dnf --assumeyes install "dnf-command(config-manager)" && \ | ||
dnf config-manager --save \ | ||
--setopt=${extra_repository}.enabled=1 && \ | ||
dnf --assumeyes install epel-release && \ | ||
dnf --assumeyes upgrade && \ | ||
dnf --assumeyes install \ | ||
boost-devel \ | ||
bzip2 \ | ||
cairo-devel \ | ||
freetype-devel \ | ||
gcc \ | ||
gcc-c++ \ | ||
gdal-devel \ | ||
harfbuzz-devel \ | ||
libicu-devel \ | ||
libjpeg-devel \ | ||
libpng-devel \ | ||
libtiff-devel \ | ||
libwebp-devel \ | ||
libxml2-devel \ | ||
make \ | ||
patch \ | ||
postgresql-devel \ | ||
proj-devel \ | ||
python3 \ | ||
python3-scons \ | ||
sqlite-devel \ | ||
tar \ | ||
zlib-devel | ||
|
||
## Download, Build & Install `Mapnik` | ||
WORKDIR /usr/local/src/mapnik | ||
RUN --mount=id=centos:stream${centos_stream_version}-mapnik:${mapnik_version},target=/usr/local/src/mapnik,type=cache \ | ||
export DESTDIR="/tmp/mapnik"; \ | ||
export GDAL_DATA="$(gdal-config --datadir)"; \ | ||
export JOBS="$(nproc)"; \ | ||
export PROJ_LIB="/usr/share/proj"; \ | ||
export PYTHON="python3"; \ | ||
mkdir --parents ${GDAL_DATA} ${PROJ_LIB}; \ | ||
if [ ! -f SConstruct ]; then \ | ||
curl --silent --location https://github.com/mapnik/mapnik/releases/download/v${mapnik_version}/mapnik-v${mapnik_version}.tar.bz2 \ | ||
| tar --extract --bzip2 --strip-components=1 --file=-; \ | ||
if [ "${centos_stream_version}" = "9" ]; then \ | ||
curl --silent --location https://github.com/mapnik/mapnik/commit/8944e81367d2b3b91a41e24116e1813c01491e5d.patch \ | ||
| patch -Np1; \ | ||
curl --silent --location https://github.com/mapnik/mapnik/commit/83779b7b6bdd229740b1b5e12a4a8fe27114cb7d.patch \ | ||
| patch -F3 -Np1; \ | ||
fi \ | ||
fi; \ | ||
if [ "${centos_stream_version}" = "8" ]; then \ | ||
export SCONS_CMD="scons-3"; \ | ||
export CUSTOM_CFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"; \ | ||
export CUSTOM_CXXFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"; \ | ||
fi; \ | ||
${SCONS_CMD:-scons} configure \ | ||
CPP_TESTS=False \ | ||
CUSTOM_CFLAGS="${CUSTOM_CFLAGS:-}" \ | ||
CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS:-}" \ | ||
CUSTOM_LDFLAGS="${CUSTOM_LDFLAGS:-}" \ | ||
DEMO=False \ | ||
DESTDIR="${DESTDIR}" \ | ||
FAST=True \ | ||
INPUT_PLUGINS=all \ | ||
LIBDIR_SCHEMA=lib64 \ | ||
OPTIMIZATION=2 \ | ||
PREFIX=/usr \ | ||
SVG2PNG=True \ | ||
XMLPARSER=libxml2 && \ | ||
make PYTHON="${PYTHON}" && \ | ||
make install PYTHON="${PYTHON}" | ||
|
||
# Builder | ||
FROM quay.io/centos/centos:stream${centos_stream_version} as builder | ||
|
||
## Arguments | ||
ARG centos_stream_version | ||
ARG extra_repository | ||
|
||
## Install builder dependencies | ||
RUN --mount=id=centos:stream${centos_stream_version}-/var/cache/dnf,target=/var/cache/dnf,type=cache,sharing=locked \ | ||
echo "install_weak_deps=False" >> /etc/dnf/dnf.conf && \ | ||
echo "keepcache=True" >> /etc/dnf/dnf.conf && \ | ||
dnf --assumeyes install "dnf-command(config-manager)" && \ | ||
dnf config-manager --save \ | ||
--setopt=${extra_repository}.enabled=1 && \ | ||
dnf --assumeyes install epel-release && \ | ||
dnf --assumeyes upgrade && \ | ||
dnf --assumeyes install \ | ||
automake \ | ||
boost-devel \ | ||
cairo-devel \ | ||
gcc \ | ||
gcc-c++ \ | ||
gdal \ | ||
glib2-devel \ | ||
harfbuzz-devel \ | ||
httpd-devel \ | ||
iniparser-devel \ | ||
libcurl-devel \ | ||
libicu-devel \ | ||
libjpeg-devel \ | ||
libmemcached-devel \ | ||
librados2-devel \ | ||
libtiff-devel \ | ||
libwebp-devel \ | ||
libxml2-devel \ | ||
make \ | ||
proj-devel \ | ||
redhat-rpm-config \ | ||
sqlite-devel | ||
|
||
## Copy files from builder(s) | ||
### Mapnik | ||
COPY --from=mapnik-builder /tmp/mapnik / | ||
|
||
## Build, Test & Install `mod_tile` | ||
COPY . /tmp/mod_tile_src | ||
WORKDIR /tmp/mod_tile_src | ||
RUN ./autogen.sh && \ | ||
./configure && \ | ||
make | ||
RUN export DESTDIR=/tmp/mod_tile && \ | ||
./gen_tile_test && \ | ||
make DESTDIR=${DESTDIR} install install-mod_tile | ||
|
||
# Runner | ||
FROM quay.io/centos/centos:stream${centos_stream_version} as runner | ||
|
||
## Arguments | ||
ARG centos_stream_version | ||
ARG extra_repository | ||
|
||
## Install runner dependencies | ||
RUN --mount=id=centos:stream${centos_stream_version}-/var/cache/dnf,target=/var/cache/dnf,type=cache,sharing=locked \ | ||
echo "install_weak_deps=False" >> /etc/dnf/dnf.conf && \ | ||
echo "keepcache=True" >> /etc/dnf/dnf.conf && \ | ||
dnf --assumeyes install "dnf-command(config-manager)" && \ | ||
dnf config-manager --save \ | ||
--setopt=${extra_repository}.enabled=1 && \ | ||
dnf --assumeyes install epel-release && \ | ||
dnf --assumeyes upgrade && \ | ||
dnf --assumeyes install \ | ||
boost-filesystem \ | ||
boost-program-options \ | ||
boost-regex \ | ||
cairo \ | ||
gdal \ | ||
harfbuzz \ | ||
httpd \ | ||
iniparser \ | ||
libicu \ | ||
libmemcached \ | ||
librados2 \ | ||
libtiff \ | ||
libwebp \ | ||
proj | ||
|
||
## Copy files from builder(s) | ||
### Mapnik | ||
COPY --from=mapnik-builder /tmp/mapnik / | ||
### mod_tile | ||
COPY --from=builder /tmp/mod_tile / | ||
COPY --chown=apache:apache --from=builder \ | ||
/tmp/mod_tile_src/utils/example-map \ | ||
/usr/share/renderd/example-map | ||
COPY --from=builder \ | ||
/tmp/mod_tile_src/etc/apache2/renderd-example-map.conf \ | ||
/etc/httpd/conf.d/renderd-example-map.conf | ||
|
||
RUN printf "LoadModule tile_module $(find /usr -name mod_tile.so)\n" > /etc/httpd/conf.modules.d/11-tile.conf | ||
|
||
RUN sed \ | ||
--expression "s#/usr/lib/mapnik/3.1/input#$(find /usr -mindepth 1 -type d -name input)#g" \ | ||
--expression "s#/usr/share/fonts/truetype#/usr/share/fonts#g" \ | ||
/usr/local/etc/renderd.conf > /etc/renderd.conf && \ | ||
printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf | ||
|
||
RUN mkdir --parents /run/renderd /var/cache/renderd/tiles | ||
|
||
CMD /usr/sbin/httpd -e debug -k start; \ | ||
G_MESSAGES_DEBUG=${G_MESSAGES_DEBUG:-info} renderd --foreground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Arguments | ||
ARG debian_version=12 | ||
ARG libmapnik_version=3.1 | ||
|
||
# Builder | ||
FROM debian:${debian_version} as builder | ||
|
||
## Arguments | ||
ARG debian_version | ||
|
||
## Install builder dependencies | ||
RUN --mount=id=debian:${debian_version}-/var/cache/apt,sharing=locked,target=/var/cache/apt,type=cache \ | ||
--mount=id=debian:${debian_version}-/var/lib/apt,sharing=locked,target=/var/lib/apt,type=cache \ | ||
export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get --yes update && \ | ||
apt-get --yes upgrade && \ | ||
apt-get --no-install-recommends --yes install \ | ||
apache2 \ | ||
apache2-dev \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
libcairo2-dev \ | ||
libcurl4-openssl-dev \ | ||
libglib2.0-dev \ | ||
libiniparser-dev \ | ||
libmapnik-dev \ | ||
libmemcached-dev \ | ||
librados-dev \ | ||
netbase | ||
|
||
## Build, Test & Install `mod_tile` | ||
COPY . /tmp/mod_tile_src | ||
WORKDIR /tmp/mod_tile_src | ||
RUN ./autogen.sh && \ | ||
./configure && \ | ||
make | ||
RUN export DESTDIR=/tmp/mod_tile && \ | ||
./gen_tile_test && \ | ||
make DESTDIR=${DESTDIR} install install-mod_tile | ||
|
||
# Runner | ||
FROM debian:${debian_version} as runner | ||
|
||
## Arguments | ||
ARG debian_version | ||
ARG libmapnik_version | ||
|
||
## Install runner dependencies | ||
RUN --mount=id=debian:${debian_version}-/var/cache/apt,sharing=locked,target=/var/cache/apt,type=cache \ | ||
--mount=id=debian:${debian_version}-/var/lib/apt,sharing=locked,target=/var/lib/apt,type=cache \ | ||
export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get --yes update && \ | ||
apt-get --yes upgrade && \ | ||
apt-get --no-install-recommends --yes install \ | ||
apache2 \ | ||
libcairo2 \ | ||
libcurl4 \ | ||
libglib2.0 \ | ||
libiniparser1 \ | ||
libmapnik${libmapnik_version} \ | ||
libmemcached11 \ | ||
librados2 | ||
|
||
## Copy files from builder(s) | ||
### mod_tile | ||
COPY --from=builder /tmp/mod_tile / | ||
COPY --from=builder \ | ||
/tmp/mod_tile_src/utils/example-map \ | ||
/usr/share/renderd/example-map | ||
COPY --from=builder \ | ||
/tmp/mod_tile_src/etc/apache2/renderd-example-map.conf \ | ||
/etc/apache2/sites-available/renderd-example-map.conf | ||
|
||
## Fix mapnik directories | ||
RUN sed \ | ||
--expression "s#/usr/lib/mapnik/3.1/input#$(find /usr -mindepth 1 -type d -name input)#g" \ | ||
--expression "s#/usr/share/fonts/truetype#/usr/share/fonts#g" \ | ||
/usr/local/etc/renderd.conf > /etc/renderd.conf | ||
|
||
## Add configuration | ||
RUN printf "LoadModule tile_module $(find /usr -name mod_tile.so)\n" > /etc/apache2/mods-available/tile.load | ||
RUN printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf | ||
RUN printf '\n[example-map-jpg]\nTYPE=jpg image/jpeg jpeg\nURI=/tiles/renderd-example-jpg\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf | ||
RUN printf '\n[example-map-png256]\nTYPE=png image/png png256\nURI=/tiles/renderd-example-png256\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf | ||
RUN printf '\n[example-map-png32]\nTYPE=png image/png png32\nURI=/tiles/renderd-example-png32\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf | ||
RUN printf '\n[example-map-webp]\nTYPE=webp image/webp webp\nURI=/tiles/renderd-example-webp\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf | ||
|
||
## Create missing directories | ||
RUN mkdir --parents /run/renderd /var/cache/renderd/tiles | ||
|
||
## Enable module & site | ||
RUN a2enmod tile && \ | ||
a2ensite renderd-example-map | ||
|
||
## Start services | ||
CMD apachectl -e debug -k start; \ | ||
G_MESSAGES_DEBUG=${G_MESSAGES_DEBUG:-info} renderd --foreground |
Oops, something went wrong.