Skip to content

Commit ba942f8

Browse files
Dockerfile: reduce the size of the image (#363)
* Dockerfile: one line per debian package * Dockerfile: reduce the size of the image By statically compile and using multi-cache build, the size of the image is now 88MB. Previously, it was around 700MB.
1 parent 965f6ae commit ba942f8

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

Dockerfile

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1-
FROM debian:bullseye-slim
1+
FROM debian:bullseye-slim AS src
22
LABEL Description="Tilemaker" Version="1.4.0"
33

44
ARG DEBIAN_FRONTEND=noninteractive
55

66
# install dependencies
77
RUN apt-get update && \
88
apt-get install -y --no-install-recommends \
9-
build-essential liblua5.1-0 liblua5.1-0-dev libprotobuf-dev libsqlite3-dev protobuf-compiler shapelib libshp-dev libboost-program-options-dev libboost-filesystem-dev libboost-system-dev libboost-iostreams-dev rapidjson-dev
9+
build-essential \
10+
liblua5.1-0 \
11+
liblua5.1-0-dev \
12+
libprotobuf-dev \
13+
libsqlite3-dev \
14+
protobuf-compiler \
15+
shapelib \
16+
libshp-dev \
17+
libboost-program-options-dev \
18+
libboost-filesystem-dev \
19+
libboost-system-dev \
20+
libboost-iostreams-dev \
21+
rapidjson-dev \
22+
cmake
1023

11-
COPY . /
12-
WORKDIR /
24+
COPY CMakeLists.txt /
25+
COPY cmake /cmake
26+
COPY src /src
27+
COPY include /include
28+
29+
WORKDIR /build
1330

14-
RUN make && \
15-
make install && \
16-
# clean up, remove build-time only dependencies
17-
rm -rf /var/lib/apt/lists/* && \
18-
apt-get purge -y --auto-remove build-essential liblua5.1-0-dev
31+
RUN cmake -DTILEMAKER_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ ..
32+
RUN cmake --build .
33+
RUN strip tilemaker
34+
35+
FROM debian:bullseye-slim
36+
WORKDIR /
37+
COPY --from=src /build/tilemaker .
38+
COPY resources /resources
39+
COPY process.lua .
40+
COPY config.json .
1941

20-
ENTRYPOINT ["tilemaker"]
42+
ENTRYPOINT ["/tilemaker"]

0 commit comments

Comments
 (0)