Skip to content

Changing the Dockerfile forcibly invalidates the ADD cache #8330

@pwaller

Description

@pwaller

I have a long, complicated Dockerfile, and towards the end I do:

ADD . /app
RUN /app/installation.sh

It's frustrating that if I make a modification to the Dockerfile after the ADD (but otherwise don't touch anything in ., the cache is unnecessarily** invalidated. My instinct was to put Dockerfile in .dockerignore but then I hit #7969.

I'm just raising this issue in case there is a possibility of finding a non-intrusive way of fixing or working around this.

(**In my case it's unnecessary because I don't read the Dockerfile from within the container. I don't know whether there are environments we can imagine that might care about the contents of the Dockerfile within the container.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/builderBuildkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions