Skip to content

Commit

Permalink
Updated Docker-based building and testing method
Browse files Browse the repository at this point in the history
  • Loading branch information
hummeltech committed Mar 16, 2024
1 parent 0d13f9f commit b6e4f8a
Show file tree
Hide file tree
Showing 19 changed files with 1,002 additions and 188 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@
!docs/man
!etc/apache2/renderd-example-map.conf
!etc/apache2/tile.load.in
!etc/renderd/renderd.conf.examples
!etc/renderd/renderd.conf.in
!includes
!src
!tests
!utils/example-map

# AutoTools
!autogen.sh
!configure.ac
!etc/renderd/renderd.conf
!m4
!Makefile.am
!modules.mk
26 changes: 22 additions & 4 deletions .github/workflows/docker-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jobs:
strategy:
matrix:
service-name:
- archlinux
- centos-7
- centos-stream-8
- centos-stream-9
- debian-11
- debian-12
- debian-testing
- debian-testing-autotools
- fedora-38
- fedora-39
- fedora-rawhide
Expand All @@ -29,6 +31,7 @@ jobs:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-devel
- ubuntu-devel-autotools
fail-fast: false
steps:
- name: Checkout repository
Expand All @@ -40,19 +43,34 @@ jobs:

- name: Test
run: |
until $(curl --fail --output tile.png --silent http://localhost:8081/tiles/renderd-example/9/297/191.png); do
until $(curl --fail --output tile.jpg.file.0 --silent http://localhost:8081/tiles/renderd-example-jpg/9/297/191.jpg); do
echo 'Sleeping 5s';
sleep 5;
done
echo 'dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.png' | sha256sum --check
sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.jpg.file.0 | grep -q OK
until $(curl --fail --output tile.png256.file.0 --silent http://localhost:8081/tiles/renderd-example-png256/9/297/191.png); do
echo 'Sleeping 5s';
sleep 5;
done
sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.png256.file.0 | grep -q OK
until $(curl --fail --output tile.png32.file.0 --silent http://localhost:8081/tiles/renderd-example-png32/9/297/191.png); do
echo 'Sleeping 5s';
sleep 5;
done
sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.png32.file.0 | grep -q OK
until $(curl --fail --output tile.webp.file.0 --silent http://localhost:8081/tiles/renderd-example-webp/9/297/191.webp); do
echo 'Sleeping 5s';
sleep 5;
done
sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.webp.file.0 | grep -q OK
timeout-minutes: 1

- name: Show logs
if: failure()
run: docker compose logs
working-directory: docker
if: failure()

- name: Stop
if: success() || failure()
run: docker compose down --volumes
working-directory: docker
if: success() || failure()
4 changes: 4 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
COMPOSE_PROJECT_NAME=mod_tile
DOWNLOAD_PBF=https://download.geofabrik.de/europe/germany/nordrhein-westfalen/koeln-regbez-latest.osm.pbf
PGDATABASE=gis
PGHOST=postgres
PGUSER=renderer
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ For your convenience, we have provided a Docker-based building and testing metho

### The following distributions are currently supported:

- archlinux _(Arch Linux)_ [[Dockerfile](/docker/archlinux/Dockerfile)]
- centos-7 _(CentOS 7)_ [[Dockerfile](/docker/centos/7/Dockerfile)]
- centos-stream-8 _(CentOS Stream 8)_ [[Dockerfile](/docker/centos/stream/Dockerfile)]
- centos-stream-9 _(CentOS Stream 9)_ [[Dockerfile](/docker/centos/stream/Dockerfile)]
Expand Down
100 changes: 100 additions & 0 deletions docker/archlinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Arguments
ARG runner_additional_packages

# Builder
FROM archlinux:latest as builder

## Install builder dependencies
RUN --mount=id=archlinux:latest-/var/cache/pacman/pkg,sharing=locked,target=/var/cache/pacman/pkg,type=cache \
--mount=id=archlinux:latest-/var/lib/pacman/sync,sharing=locked,target=/var/lib/pacman/sync,type=cache \
pacman --sync --refresh --sysupgrade --noconfirm \
apache \
apr \
boost \
cairo \
cmake \
curl \
extra-cmake-modules \
gcc \
git \
glib2 \
iniparser \
lcov \
libmemcached \
make \
mapnik \
memcached \
pkgconf

## Build, Test & Install `mod_tile`
COPY . /tmp/mod_tile_src
WORKDIR /tmp/mod_tile_build
RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
cmake -B . -S /tmp/mod_tile_src \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_RUNSTATEDIR=/run \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DENABLE_TESTS:BOOL=ON && \
cmake --build .
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
export DESTDIR=/tmp/mod_tile && \
ctest --output-on-failure && \
(cmake --install . --strip || make DESTDIR=${DESTDIR} install/strip)

# Runner
FROM archlinux:latest as runner

## Arguments
ARG runner_additional_packages

## Install runner dependencies
RUN --mount=id=archlinux:latest-/var/cache/pacman/pkg,sharing=locked,target=/var/cache/pacman/pkg,type=cache \
--mount=id=archlinux:latest-/var/lib/pacman/sync,sharing=locked,target=/var/lib/pacman/sync,type=cache \
pacman --sync --refresh --sysupgrade --noconfirm ${runner_additional_packages} \
apache \
cairo \
curl \
glib2 \
iniparser \
libmemcached \
mapnik \
memcached \
# GDAL optional dependencies
arrow \
cfitsio \
hdf5 \
libheif \
libjxl \
mariadb-libs \
netcdf \
openexr \
openjpeg2 \
podofo \
poppler

## 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/httpd/conf/extra/httpd-tile-renderd-example-map.conf

## Add configuration
RUN printf '\n[example-map]\nMAXZOOM=20\nMINZOOM=0\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
RUN printf '\n[example-map-jpg]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\nTYPE=webp image/webp webp\nURI=/tiles/renderd-example-webp\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf

## Enable module & site
RUN printf '\nInclude conf/extra/httpd-tile.conf\n' >> /etc/httpd/conf/httpd.conf && \
printf '\nInclude conf/extra/httpd-tile-renderd-example-map.conf\n' >> /etc/httpd/conf/httpd.conf

## Start services
CMD httpd -e debug -k start; \
G_MESSAGES_DEBUG=${G_MESSAGES_DEBUG:-info} renderd --foreground
31 changes: 18 additions & 13 deletions docker/centos/7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ RUN --mount=id=centos:centos7-/var/cache/yum,target=/var/cache/yum,type=cache,sh
boost169-devel \
bzip2 \
cairo-devel \
freetype-devel \
devtoolset-9-gcc \
devtoolset-9-gcc-c++ \
freetype-devel \
gdal-devel \
harfbuzz-devel \
libicu-devel \
Expand Down Expand Up @@ -81,14 +81,14 @@ RUN --mount=id=centos:centos7-/var/cache/yum,target=/var/cache/yum,type=cache,sh
ulimit -n 40000; \
echo "install_weak_deps=0" >> /etc/yum.conf && \
sed --in-place 's/keepcache=0/keepcache=1/g' /etc/yum.conf && \
yum --assumeyes install epel-release && \
yum --assumeyes install epel-release centos-release-scl && \
yum --assumeyes upgrade && \
yum --assumeyes install \
boost169-devel \
cairo-devel \
cmake3 \
gcc \
gcc-c++ \
devtoolset-9-gcc \
devtoolset-9-gcc-c++ \
gdal \
glib2-devel \
harfbuzz-devel \
Expand All @@ -111,17 +111,22 @@ COPY --from=mapnik-builder /tmp/mapnik /
## Build, Test & Install `mod_tile`
COPY . /tmp/mod_tile_src
WORKDIR /tmp/mod_tile_build
RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
RUN source /opt/rh/devtoolset-9/enable && \
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
export CFLAGS="-I/usr/include/boost169" && \
export CXXFLAGS="-I/usr/include/boost169" && \
cmake3 -B . -S /tmp/mod_tile_src \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_RUNSTATEDIR=/run \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DENABLE_TESTS:BOOL=ON && \
cmake3 --build .
RUN export DESTDIR=/tmp/mod_tile && \
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
export DESTDIR=/tmp/mod_tile && \
ctest3 --output-on-failure && \
(cmake3 --install . --prefix /usr --strip || make DESTDIR=${DESTDIR} install/strip) && \
mv /tmp/mod_tile/var/run /tmp/mod_tile/run
(cmake3 --install . --strip || make DESTDIR=${DESTDIR} install/strip)

# Runner
FROM centos:centos7 as runner
Expand Down Expand Up @@ -162,11 +167,11 @@ COPY --from=builder \
/etc/httpd/conf.d/renderd-example-map.conf

## Add configuration
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
RUN printf '\n[example-map]\nMAXZOOM=20\nMINZOOM=0\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
RUN printf '\n[example-map-jpg]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\nTYPE=webp image/webp webp\nURI=/tiles/renderd-example-webp\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf

## Start services
CMD httpd -e debug -k start; \
Expand Down
21 changes: 13 additions & 8 deletions docker/centos/stream/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ RUN --mount=id=centos:stream${centos_stream_version}-/var/cache/dnf,target=/var/
libtiff \
libwebp \
make \
procps \
proj

## Copy files from builder(s)
Expand All @@ -131,12 +132,16 @@ WORKDIR /tmp/mod_tile_build
RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
cmake -B . -S /tmp/mod_tile_src \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_RUNSTATEDIR=/run \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DENABLE_TESTS:BOOL=ON && \
cmake --build .
RUN export DESTDIR=/tmp/mod_tile && \
RUN export CTEST_PARALLEL_LEVEL=$(nproc) && \
export DESTDIR=/tmp/mod_tile && \
ctest --output-on-failure && \
(cmake --install . --prefix /usr --strip || make DESTDIR=${DESTDIR} install/strip) && \
mv /tmp/mod_tile/var/run /tmp/mod_tile/run
(cmake --install . --strip || make DESTDIR=${DESTDIR} install/strip)

# Runner
FROM quay.io/centos/centos:stream${centos_stream_version} as runner
Expand Down Expand Up @@ -183,11 +188,11 @@ COPY --from=builder \
/etc/httpd/conf.d/renderd-example-map.conf

## Add configuration
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
RUN printf '\n[example-map]\nMAXZOOM=20\nMINZOOM=0\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf
RUN printf '\n[example-map-jpg]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\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]\nMAXZOOM=20\nMINZOOM=0\nTYPE=webp image/webp webp\nURI=/tiles/renderd-example-webp\nXML=/usr/share/renderd/example-map/mapnik.xml\n' >> /etc/renderd.conf

## Start services
CMD httpd -e debug -k start; \
Expand Down

0 comments on commit b6e4f8a

Please sign in to comment.