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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
From 122ee1b68f47c7331667eb9117381c6c2e521c51 Mon Sep 17 00:00:00 2001
From: "Daniel J. H" <daniel+github@trvx.org>
Date: Wed, 8 May 2024 18:55:02 +0200
Subject: Improves docker setup for basic usage to get started more easily
(#713)
---
Dockerfile | 100 +++++++++++++++++----------------
README.md | 13 +++++
docs/INSTALL.md | 6 +-
resources/docker-entrypoint.sh | 2 +-
4 files changed, 71 insertions(+), 50 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 8158ef0..662c99e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,52 +1,56 @@
-FROM debian:bullseye-slim AS src
+FROM debian:bookworm-slim AS src
LABEL Description="Tilemaker" Version="1.4.0"
-ARG DEBIAN_FRONTEND=noninteractive
-
-# install dependencies
-RUN apt-get update && \
- apt-get install -y --no-install-recommends \
- build-essential \
- liblua5.1-0 \
- liblua5.1-0-dev \
- libsqlite3-dev \
- shapelib \
- libshp-dev \
- libboost-program-options-dev \
- libboost-filesystem-dev \
- libboost-system-dev \
- libboost-iostreams-dev \
- rapidjson-dev \
- cmake \
- zlib1g-dev
-
-COPY CMakeLists.txt /
-COPY cmake /cmake
-COPY src /src
-COPY include /include
-COPY server /server
-
-WORKDIR /build
-
-RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ ..
-RUN cmake --build .
-RUN strip tilemaker
-RUN strip tilemaker-server
-
-FROM debian:bullseye-slim
-RUN apt-get update && \
- apt-get install -y --no-install-recommends \
- liblua5.1-0 \
- libshp-dev \
- libsqlite3-dev \
- libboost-filesystem-dev \
- libboost-program-options-dev \
- libboost-iostreams-dev
-WORKDIR /
-COPY --from=src /build/tilemaker .
-COPY resources /resources
-COPY process.lua .
-COPY config.json .
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+ build-essential \
+ liblua5.1-0-dev \
+ libsqlite3-dev \
+ libshp-dev \
+ libboost-program-options-dev \
+ libboost-filesystem-dev \
+ libboost-system-dev \
+ libboost-iostreams-dev \
+ rapidjson-dev \
+ cmake \
+ zlib1g-dev && \
+ rm -rf /var/lib/apt/lists/*
+
+WORKDIR /usr/src/app
+
+COPY CMakeLists.txt ./
+COPY cmake ./cmake
+COPY src ./src
+COPY include ./include
+COPY server ./server
+
+RUN mkdir build && \
+ cd build && \
+ cmake -DCMAKE_BUILD_TYPE=Release .. && \
+ cmake --build . --parallel $(nproc) && \
+ strip tilemaker && \
+ strip tilemaker-server
+
+ENV PATH="/usr/src/app/build:$PATH"
+
+FROM debian:bookworm-slim
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+ liblua5.1-0 \
+ shapelib \
+ libsqlite3-0 \
+ libboost-filesystem1.74.0 \
+ libboost-program-options1.74.0 \
+ libboost-iostreams1.74.0 && \
+ rm -rf /var/lib/apt/lists/*
+
+WORKDIR /usr/src/app
+COPY --from=src /usr/src/app/build/tilemaker .
+COPY --from=src /usr/src/app/build/tilemaker-server .
+COPY resources ./resources
+COPY process.lua ./
+COPY config.json ./
+
+ENV PATH="/usr/src/app/build:$PATH"
# Entrypoint for docker, wrapped with /bin/sh to remove requirement for executable permissions on script
-ENTRYPOINT ["/bin/sh", "/resources/docker-entrypoint.sh"]
+ENTRYPOINT ["/bin/sh", "/usr/src/app/resources/docker-entrypoint.sh"]
+CMD ["--help"]
diff --git a/README.md b/README.md
index 84edd5b..7a40dde 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,19 @@ See an example of a vector tile map produced by tilemaker at [tilemaker.org](htt

+## Getting Started
+
+We provide a ready-to-use docker image that gets you started without having to compile tilemaker from source:
+
+1. Go to http://download.geofabrik.de/europe.html and download the `monaco-latest.osm.pbf` snapshot of OpenStreetMap
+
+2. Run tilemaker on the OpenStreetMap snapshot to generate [Protomaps](https://protomaps.com) vector tiles:
+
+ docker run -it --rm -v (pwd):/data ghcr.io/systemed/tilemaker:master /data/monaco-latest.osm.pbf --output /data/monaco-latest.pmtiles
+
+3. Check out what's in the vector tiles e.g. by using the debug viewer [here](https://protomaps.github.io/PMTiles/)
+
+
## Installing
tilemaker is written in C++14. The chief dependencies are:
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index 26cef84..80b8c98 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -62,6 +62,10 @@ Build from project root directory with:
The docker container can be run like this:
- docker run -v /Users/Local/Downloads/:/srv -i -t --rm tilemaker /srv/germany-latest.osm.pbf --output=/srv/germany.mbtiles
+ docker run -it --rm -v $(pwd):/data tilemaker /data/monaco-latest.osm.pbf --output /data/monaco-latest.pmtiles
+
+The tilemaker-server can be run like this:
+
+ docker run -it --rm -v $(pwd):/data --entrypoint /usr/src/app/tilemaker-server tilemaker --help
Keep in mind to map the volume your .osm.pbf files are in to a path within your docker container, as seen in the example above.
diff --git a/resources/docker-entrypoint.sh b/resources/docker-entrypoint.sh
index 8c267bc..0c3b987 100755
--- a/resources/docker-entrypoint.sh
+++ b/resources/docker-entrypoint.sh
@@ -6,4 +6,4 @@ echo "DOCKER WARNING: The --store option can be used to partly reduce memory usa
echo "--------------------------------------------------------------------------------" >&2
# Proceed to run the command passed to the script
-exec /tilemaker "$@"
\ No newline at end of file
+exec /usr/src/app/tilemaker "$@"
--
2.47.3
|