You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
To using --cache-from to use the previous bentobox-engine container as build cache.
However our build times for the bentobox-engine container is still around 12 minutes,
which is similar if just built from scratch without caching.
Investigation
The previous bentobox-engine used as build cache is built to the release build stage
which only contains layers from the base build stage + the Engine executable:
Encountering FROM base as release, Docker throws away all build build stage layers.
FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
# install apt runtime dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \
libglfw3-dev xvfb xorg-dev ca-certificates
FROM base as build
# .... building FROM base as release
# clean apt-get cacheRUN rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/archives/*
# copy built binary into release imageCOPY --from=build /repo/sim/build/bentobox /bentobox
As such when --cache-from attempts to use layers as build cache only the very first layers
in the base build stage are available, causing the rest of the build build stage layers to be rebuilt.
Fix
Publish a 'build' variant of the bentobox-engine container with build build stage layers
and direct --cache-from to use that 'build' variant. This should result in better cached container builds.
The text was updated successfully, but these errors were encountered:
mrzzy
changed the title
Docker Caching Again: Use bentobox-engine with 'build' build stage as build cache
Docker Caching: Fix bentobox-engine with losing 'build' build stage layers as build cache
Feb 20, 2021
Problem
Post #29, we switched the CI/CD from:
--cache-from
to use the previous bentobox-engine container as build cache.However our build times for the bentobox-engine container is still around 12 minutes,
which is similar if just built from scratch without caching.
Investigation
The previous bentobox-engine used as build cache is built to the
release
build stagewhich only contains layers from the
base
build stage + the Engine executable:FROM base as release
, Docker throws away allbuild
build stage layers.As such when
--cache-from
attempts to use layers as build cache only the very first layersin the
base
build stage are available, causing the rest of thebuild
build stage layers to be rebuilt.Fix
Publish a 'build' variant of the bentobox-engine container with
build
build stage layersand direct
--cache-from
to use that 'build' variant. This should result in better cached container builds.The text was updated successfully, but these errors were encountered: