Skip to content

Commit 94c0040

Browse files
authored
Add optional BUILD_DEBUG build argument (#753)
1 parent b863710 commit 94c0040

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
FROM debian:bookworm-slim AS src
22
LABEL Description="Tilemaker" Version="1.4.0"
33

4+
ARG BUILD_DEBUG=
5+
46
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
57
build-essential \
68
liblua5.1-0-dev \
@@ -25,21 +27,33 @@ COPY server ./server
2527

2628
RUN mkdir build && \
2729
cd build && \
28-
cmake -DCMAKE_BUILD_TYPE=Release .. && \
30+
if [ -z "$BUILD_DEBUG" ]; then \
31+
cmake -DCMAKE_BUILD_TYPE=Release ..; \
32+
else \
33+
cmake -DCMAKE_BUILD_TYPE=Debug ..; \
34+
fi; \
2935
cmake --build . --parallel $(nproc) && \
30-
strip tilemaker && \
31-
strip tilemaker-server
36+
if [ -z "$BUILD_DEBUG" ]; then \
37+
strip tilemaker && \
38+
strip tilemaker-server; \
39+
fi
3240

3341
ENV PATH="/usr/src/app/build:$PATH"
3442

3543
FROM debian:bookworm-slim
44+
45+
ARG BUILD_DEBUG=
46+
3647
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
3748
liblua5.1-0 \
3849
shapelib \
3950
libsqlite3-0 \
4051
lua-sql-sqlite3 \
4152
libboost-filesystem1.74.0 \
4253
libboost-program-options1.74.0 && \
54+
if [ -n "$BUILD_DEBUG" ]; then \
55+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gdb; \
56+
fi; \
4357
rm -rf /var/lib/apt/lists/*
4458

4559
WORKDIR /usr/src/app

docs/INSTALL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ Build from project root directory with:
6060

6161
docker build . -t tilemaker
6262

63+
It can also be build with a `BUILD_DEBUG` build argument, which will build the executables for Debug, and not strip out symbols. `gdb` will also
64+
installed to facilate debugging:
65+
66+
docker build . --build-arg BUILD_DEBUG=1 -t tilemaker
67+
6368
The docker container can be run like this:
6469

6570
docker run -it --rm -v $(pwd):/data tilemaker /data/monaco-latest.osm.pbf --output /data/monaco-latest.pmtiles

0 commit comments

Comments
 (0)