Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libtbb-dev/libtbb12 packages in Dockerfile-debian, sort packages alphabetically in both Dockerfiles #7095

Merged
merged 5 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions docker/Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
FROM alpine:3.20.0 as alpine-mimalloc
FROM alpine:3.20.5 AS alpine-mimalloc

RUN apk add --no-cache mimalloc

ENV LD_PRELOAD=/usr/lib/libmimalloc.so.2
ENV MIMALLOC_LARGE_OS_PAGES=1


FROM alpine-mimalloc as builder
FROM alpine-mimalloc AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src && mkdir -p /opt

RUN apk add --no-cache \
cmake make git clang libbz2 libxml2 \
boost-dev boost-program_options boost-filesystem boost-iostreams boost-thread \
lua5.4-dev onetbb-dev expat-dev
RUN mkdir -p /src /opt && \
apk add --no-cache \
boost-dev \
boost-filesystem \
boost-iostreams \
boost-program_options \
boost-thread \
clang \
cmake \
expat-dev \
git \
libbz2 \
libxml2 \
lua5.4-dev \
make \
onetbb-dev

COPY . /src
WORKDIR /src
Expand All @@ -39,16 +50,21 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
rm -rf /src


# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM alpine-mimalloc as runstage
FROM alpine-mimalloc AS runstage

COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt

RUN apk add --no-cache \
boost-program_options boost-date_time boost-iostreams boost-thread \
expat lua5.4 onetbb && \
boost-date_time \
boost-iostreams \
boost-program_options \
boost-thread \
expat \
lua5.4 \
onetbb && \
ldconfig /usr/local/lib

RUN /usr/local/bin/osrm-extract --help && \
Expand All @@ -60,3 +76,4 @@ RUN /usr/local/bin/osrm-extract --help && \
WORKDIR /opt

EXPOSE 5000

51 changes: 30 additions & 21 deletions docker/Dockerfile-debian
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
FROM debian:bookworm-slim as builder
FROM debian:bookworm-slim AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src && mkdir -p /opt

RUN apt-get update && \
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
libzip-dev libboost1.81-all-dev lua5.4 liblua5.4-dev pkg-config -o APT::Install-Suggests=0 -o APT::Install-Recommends=0

RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
ldconfig /usr/local/lib && \
git clone --branch v2021.12.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \
cd oneTBB && \
mkdir build && \
cd build && \
cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build . && \
cmake --install .
RUN mkdir -p /src /opt && \
apt-get update && \
apt-get -y --no-install-recommends --no-install-suggests install \
ca-certificates \
cmake \
g++ \
gcc \
git \
libboost1.81-all-dev \
libbz2-dev \
liblua5.4-dev \
libtbb-dev \
libxml2-dev \
libzip-dev \
lua5.4 \
make \
pkg-config

COPY . /src
WORKDIR /src
Expand All @@ -41,19 +44,24 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
rm -rf /src


# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM debian:bookworm-slim as runstage
FROM debian:bookworm-slim AS runstage

COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libboost-program-options1.81.0 libboost-date-time1.81.0 libboost-iostreams1.81.0 libboost-thread1.81.0 \
expat liblua5.4-0 && \
apt-get install -y --no-install-recommends --no-install-suggests \
expat \
libboost-date-time1.81.0 \
libboost-iostreams1.81.0 \
libboost-program-options1.81.0 \
libboost-thread1.81.0 \
liblua5.4-0 \
libtbb12 && \
rm -rf /var/lib/apt/lists/* && \
# add /usr/local/lib to ldconfig to allow loading libraries from there
# Add /usr/local/lib to ldconfig to allow loading libraries from there
ldconfig /usr/local/lib

RUN /usr/local/bin/osrm-extract --help && \
Expand All @@ -65,3 +73,4 @@ RUN /usr/local/bin/osrm-extract --help && \
WORKDIR /opt

EXPOSE 5000

Loading