diff --git a/integration/dockerfiles/Dockerfile_test_cache b/integration/dockerfiles/Dockerfile_test_cache index f7ce19af3..0f80fbf21 100644 --- a/integration/dockerfiles/Dockerfile_test_cache +++ b/integration/dockerfiles/Dockerfile_test_cache @@ -18,5 +18,3 @@ FROM debian:10.13 RUN date > /date -COPY context/foo /foo -RUN echo hey diff --git a/integration/dockerfiles/Dockerfile_test_cache_install b/integration/dockerfiles/Dockerfile_test_cache_install index ae2feb195..5d044833d 100644 --- a/integration/dockerfiles/Dockerfile_test_cache_install +++ b/integration/dockerfiles/Dockerfile_test_cache_install @@ -17,7 +17,7 @@ # if the cache is implemented correctly FROM debian:10.13 +RUN mkdir /foo WORKDIR /foo RUN apt-get update && apt-get install -y make -COPY context/bar /context RUN echo "hey" > foo diff --git a/integration/dockerfiles/Dockerfile_test_cache_install_oci b/integration/dockerfiles/Dockerfile_test_cache_install_oci index ae2feb195..5d044833d 100644 --- a/integration/dockerfiles/Dockerfile_test_cache_install_oci +++ b/integration/dockerfiles/Dockerfile_test_cache_install_oci @@ -17,7 +17,7 @@ # if the cache is implemented correctly FROM debian:10.13 +RUN mkdir /foo WORKDIR /foo RUN apt-get update && apt-get install -y make -COPY context/bar /context RUN echo "hey" > foo diff --git a/integration/dockerfiles/Dockerfile_test_cache_oci b/integration/dockerfiles/Dockerfile_test_cache_oci index f7ce19af3..0f80fbf21 100644 --- a/integration/dockerfiles/Dockerfile_test_cache_oci +++ b/integration/dockerfiles/Dockerfile_test_cache_oci @@ -18,5 +18,3 @@ FROM debian:10.13 RUN date > /date -COPY context/foo /foo -RUN echo hey diff --git a/integration/dockerfiles/Dockerfile_test_issue_add b/integration/dockerfiles/Dockerfile_test_issue_add new file mode 100644 index 000000000..b50f1bfb4 --- /dev/null +++ b/integration/dockerfiles/Dockerfile_test_issue_add @@ -0,0 +1,9 @@ +FROM ubuntu AS base + +# Creates cache misses on main@1d2bff5: +# Even with --cache-copy-layers, only COPY layers are cached. +# ADD instruction is never cached. +# As a workaround use COPY instruction instead +# +# COPY context/foo foo +ADD context/foo foo diff --git a/integration/dockerfiles/Dockerfile_test_issue_empty b/integration/dockerfiles/Dockerfile_test_issue_empty new file mode 100644 index 000000000..dfbd21b92 --- /dev/null +++ b/integration/dockerfiles/Dockerfile_test_issue_empty @@ -0,0 +1,9 @@ +FROM ubuntu AS base + +# Creates cache misses on main@1d2bff5: +# When building the image directly no layer is created. +# When rebuilding from cache a layer is emitted even for empty statements, +# as we currently have no logic for skipping the layer when rebuilding from emtpy cache. +# This causes one-time cache misses as now the chain of layers has changed. +# +RUN echo blubb diff --git a/integration/dockerfiles/Dockerfile_test_issue_workdir b/integration/dockerfiles/Dockerfile_test_issue_workdir new file mode 100644 index 000000000..536942c39 --- /dev/null +++ b/integration/dockerfiles/Dockerfile_test_issue_workdir @@ -0,0 +1,8 @@ +FROM ubuntu + +# Creates cache misses on main@1d2bff5 before #3340: +# Folders created implicitly by WORKDIR are not cached. +# As a workaround create them excplicitly with RUN +# +# RUN mkdir /app +WORKDIR /app diff --git a/integration/images.go b/integration/images.go index ccf675c61..148b5d6ae 100644 --- a/integration/images.go +++ b/integration/images.go @@ -218,6 +218,12 @@ func NewDockerFileBuilder() *DockerFileBuilder { "Dockerfile_test_cache_install": {}, "Dockerfile_test_cache_perm": {}, "Dockerfile_test_cache_copy": {}, + // TODO: WORKDIR command is uncacheable + //"Dockerfile_test_issue_workdir": {}, + // TODO: ADD command is uncacheable + //"Dockerfile_test_issue_add": {}, + // TODO: Empty Layers are uncacheable + //"Dockerfile_test_issue_empty": {}, } d.TestOCICacheDockerfiles = map[string]struct{}{ "Dockerfile_test_cache_oci": {},