drop uncacheable commands

This commit is contained in:
Martin Zihlmann 2025-05-25 22:45:14 +01:00
parent 603a542f27
commit 41a97540eb
No known key found for this signature in database
GPG Key ID: 0F7784F41354DE99
8 changed files with 34 additions and 6 deletions

View File

@ -18,5 +18,3 @@
FROM debian:10.13
RUN date > /date
COPY context/foo /foo
RUN echo hey

View File

@ -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

View File

@ -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

View File

@ -18,5 +18,3 @@
FROM debian:10.13
RUN date > /date
COPY context/foo /foo
RUN echo hey

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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": {},