From 2f961f5ceaf3cd819992cd7b85fcd6f934a4367f Mon Sep 17 00:00:00 2001 From: nurikk Date: Tue, 14 Dec 2021 23:25:16 +0800 Subject: [PATCH 1/2] Split build command into two layers --- docker/Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e3d69e3b373..fe0ee31ca5c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,14 +2,15 @@ FROM debian:bullseye-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 cmake make git gcc g++ libbz2-dev libxml2-dev \ + libzip-dev libboost1.74-all-dev lua5.2 liblua5.2-dev libtbb-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 + COPY . /src WORKDIR /src -RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} && \ - apt-get update && \ - apt-get -y --no-install-recommends install cmake make git gcc g++ libbz2-dev libxml2-dev \ - libzip-dev libboost1.74-all-dev lua5.2 liblua5.2-dev libtbb-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 && \ - echo "Building OSRM ${DOCKER_TAG}" && \ +RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} echo "Building OSRM ${DOCKER_TAG}" && \ git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \ echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \ mkdir -p build && \ @@ -27,7 +28,6 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || strip /usr/local/bin/* && \ rm -rf /src /usr/local/lib/libosrm* - # Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#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:bullseye-slim as runstage From 1c74cf910f6debb5960205aa0eb98a8a3b8c1fc1 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Feb 2022 11:26:23 +0400 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de89940e3b8..04f3560208f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - CHANGED: Upgrade Ubuntu CI builds to 20.04 [#6119](https://github.com/Project-OSRM/osrm-backend/pull/6119) - CHANGED: Make building osrm-routed optional [#6144](https://github.com/Project-OSRM/osrm-backend/pull/6144) - FIXED: Run all unit tests in CI [#5248](https://github.com/Project-OSRM/osrm-backend/pull/5248) + - CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [#6175](https://github.com/Project-OSRM/osrm-backend/pull/6175) # 5.26.0 - Changes from 5.25.0