File: Dockerfile.autotools

package info (click to toggle)
libapache2-mod-tile 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,872 kB
  • sloc: cpp: 18,151; ansic: 7,574; sh: 980; makefile: 163; xml: 27
file content (111 lines) | stat: -rw-r--r-- 4,123 bytes parent folder | download
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
106
107
108
109
110
111
# hadolint global ignore=DL3008,DL3025,DL3059
# Arguments
ARG libiniparser_version=1
ARG libmapnik_version=3.1
ARG ubuntu_version=24.04

# Base
FROM ubuntu:${ubuntu_version} AS base

## Arguments
ARG ubuntu_version

## Install base dependencies
RUN --mount=type=cache,sharing=locked,id=ubuntu:${ubuntu_version}-/var/cache/apt,target=/var/cache/apt \
    --mount=type=cache,sharing=locked,id=ubuntu:${ubuntu_version}-/var/lib/apt,target=/var/lib/apt \
    export DEBIAN_FRONTEND=noninteractive && \
    apt-get --yes update && \
    apt-get --yes upgrade

# Builder
FROM base AS builder

## Arguments
ARG ubuntu_version

## Install builder dependencies
RUN --mount=type=cache,sharing=locked,id=ubuntu:${ubuntu_version}-/var/cache/apt,target=/var/cache/apt \
    --mount=type=cache,sharing=locked,id=ubuntu:${ubuntu_version}-/var/lib/apt,target=/var/lib/apt \
    export DEBIAN_FRONTEND=noninteractive && \
    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 export DESTDIR=/tmp/mod_tile && \
    ./autogen.sh && \
    ./configure && \
    make DESTDIR=${DESTDIR} install install-mod_tile
RUN make test

# Runner
FROM base AS runner

## Arguments
ARG libiniparser_version
ARG libmapnik_version
ARG ubuntu_version

## Install runner dependencies
RUN --mount=type=cache,sharing=locked,id=ubuntu:${ubuntu_version}-/var/cache/apt,target=/var/cache/apt \
    --mount=type=cache,sharing=locked,id=ubuntu:${ubuntu_version}-/var/lib/apt,target=/var/lib/apt \
    export DEBIAN_FRONTEND=noninteractive && \
    apt-get --no-install-recommends --yes install \
        apache2 \
        libcairo2 \
        libcurl4 \
        libglib2.0-0 \
        libiniparser${libiniparser_version} \
        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
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN sed \
        --expression "s#/usr/lib/mapnik/3.1/input#$(find /usr -mindepth 1 -type d -name input | grep mapnik)#g" \
        --expression "s#/usr/share/fonts/truetype#/usr/share/fonts#g" \
        /usr/local/etc/renderd.conf > /etc/renderd.conf
SHELL ["/bin/sh", "-c"]

## Add configuration
RUN printf "LoadModule tile_module %s\n" "$(find /usr -name mod_tile.so)" > /etc/apache2/mods-available/tile.load
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

## 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