From composer/composer#9768:
With given
composer.lock
and docker--cache-from
must produce same image even if the builds share no previous state.
Clone this prpoject:
git clone -b v1 https://gist.github.com/glensc/b51e9a8c180f3ca3ca1a6593931d431d composer-feat-9768
cd composer-feat-9768
Ensure pristine state, delete local build cache and images:
docker builder prune -fa
docker image prune -fa
Let's assume previous build is published at $CACHE_TAG
, and we are tagging
built image as $IMAGE_TAG
:
DOCKER_BUILDKIT=1 \
docker build \
--build-arg=BUILDKIT_INLINE_CACHE=1 \
--tag=$IMAGE_TAG \
--cache-from=$CACHE_TAG \
.