Skip to content

Dockerfile: new staged workflow for improved cache reuse

Arvid Jakobsson requested to merge arvid@a-dockerfile-that-caches into master

An issue with the marge-bot Dockerfile is that any change to the source tree (except for files listed in .dockerignore) invalidates the cache of almost all layers in the image. Consequently, changing e.g. the README.md leads to a reinstallation of dependencies.

This splits the workflow by adding a new stage requirements-exporter that serves only to export requirements.txt from poetry.lock and pyproject.toml.

In the last, production stage, we can then install dependencies and install the application in two steps, such that the cache for dependency-installation is only invalidated when poetry.lock or pyproject.toml change.

Edited by Arvid Jakobsson

Merge request reports