Skip to content

skip cleanup between stages #523

@mzihlmann

Description

@mzihlmann

Sometimes a cleanup can be skipped between stages, even squashing can't take all optimizations because we need to save the stage/files at the end. But we can just tell to the first stage to not clean the fs and to the following stage that the filesystem is intact. This has the same effect as squashing but can be more generally applied.

  FROM debian:12.10 AS first-stage
  UNPACK debian:12.10
  SAVE STAGE /kaniko/stages/0
- CLEAN

  FROM first-stage AS third-stage
- UNPACK /kaniko/stages/0
  RUN touch test
  SAVE FILES [test] /kaniko/deps/2
  CLEAN

  FROM first-stage AS fifth-stage
  UNPACK /kaniko/stages/0
  COPY --from=third-stage test test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions