Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Stage build not respecting dependency tree #815

Closed
duxbuse opened this issue Oct 14, 2019 · 5 comments · Fixed by #1165
Closed

Multi Stage build not respecting dependency tree #815

duxbuse opened this issue Oct 14, 2019 · 5 comments · Fixed by #1165
Labels
area/multi-stage builds issues related to kaniko multi-stage builds area/performance issues related to kaniko performance enhancement kind/feature-request priority/p2 High impact feature/bug. Will get a lot of users happy

Comments

@duxbuse
Copy link

duxbuse commented Oct 14, 2019

Actual behavior
Kaniko builds all stages of a multi stage then only returns the stage specified in the --target declaration.

Expected behavior
Kaniko should only build the stages that the --target has as dependencies.

To Reproduce
Multi stage file like this:

FROM alpine AS builder
  COPY ./shared-content .
  RUN make build

FROM builder AS tester
  COPY testingPackage .
  RUN make test

FROM builder AS deployable
  COPY --from builder application.bin application.bin

I would expect that when building this file with --target = deployable that the test layers would not be built. Partly because they are not used so they will just be thrown away.
Current versions of docker do this dependency mapping to only build required steps.

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
@priyawadhwa priyawadhwa added area/performance issues related to kaniko performance enhancement area/multi-stage builds issues related to kaniko multi-stage builds labels Oct 15, 2019
@Akkarine
Copy link

Akkarine commented Oct 21, 2019

Same here. I would also add, that if there is no dependencies at all, kaniko will build all unwanted stages in order which they are declared in Dockerfile till it comes to target. Luckly, if target is the first stage, other stages are not initiates :)

@donmccasland
Copy link
Member

Pardon my ignorance, is there a corollary functionality in docker build?

@cvgw
Copy link
Contributor

cvgw commented Nov 28, 2019

This may be the same issue as #775

@Akkarine
Copy link

Pardon my ignorance, is there a corollary functionality in docker build?

If you use DOCKER_BUILDKIT=1, dependencies resolved correctly.

@tejal29 tejal29 added kind/feature-request priority/p2 High impact feature/bug. Will get a lot of users happy labels Jan 10, 2020
@frickenate
Copy link

frickenate commented Feb 6, 2020

Yep, being burned by this. Migrating to GitLab CI with existing multi-stage builds which were using eg. DOCKER_BUILDKIT=1 docker build --target release with the previous build system. Looking at kaniko rather than docker-in-docker, but no support for dependency resolution in multi-stage builds is a killer that has us traveling back in time to having to generate multiple Dockerfiles dynamically? Hell no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/multi-stage builds issues related to kaniko multi-stage builds area/performance issues related to kaniko performance enhancement kind/feature-request priority/p2 High impact feature/bug. Will get a lot of users happy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants