mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-23 02:23:07 +02:00
tests: Refactor Dockerfile to multi-stage (more caching during development)
The previous refactor traded build step caching for smaller image size, which in turn made fast caching of built images possible, and allowed us to speed up CI builds. But almost any change in Dockerfile required full rebuild of everything (vim & taskwarrior), so changes to the Dockerfile became more painful. This commit refactors the Dockerfile to use multi-stage builds, which brings build caching back: vim & taskwarrior are built in separate stages, which are cached step by step, and then the build artifacts are copied into the main tests image and runtime dependencies are installed. There's a catch, of course: --cache-from doesn't work with multi-stage images unless the experimental BuildKit backend and its inline cache export are enabled. This requires docker 19.03, which shouldn't be hard to obtain but isn't installed by default on Travis CI.
This commit is contained in:
parent
ae588783c1
commit
13ee57540e
2 changed files with 65 additions and 78 deletions
3
.github/workflows/tests.yaml
vendored
3
.github/workflows/tests.yaml
vendored
|
@ -36,7 +36,8 @@ jobs:
|
|||
) | sha256sum | read -r tag _
|
||||
docker login "$DOCKER_REGISTRY" -u "$GITHUB_USER" -p "$GITHUB_TOKEN" || :
|
||||
docker pull "$DOCKER_CACHE_IMAGE":"$tag" || :
|
||||
docker build \
|
||||
DOCKER_BUILDKIT=1 docker build \
|
||||
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||||
--cache-from "$DOCKER_CACHE_IMAGE":"$tag" \
|
||||
${ALPINE_VERSION:+--build-arg ALPINE_VERSION="$ALPINE_VERSION"} \
|
||||
${PYTHON_VERSION:+--build-arg PYTHON_VERSION="$PYTHON_VERSION"} \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue