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

buildkit and experimental frontend #817

Closed
astorath opened this issue Feb 6, 2019 · 3 comments · Fixed by #5357
Closed

buildkit and experimental frontend #817

astorath opened this issue Feb 6, 2019 · 3 comments · Fixed by #5357

Comments

@astorath
Copy link

astorath commented Feb 6, 2019

We are using ONBUILD options in our multistage builds. For instance:

FROM my.company.com/ci/dotnet:v1-build as build
FROM my.company.com/ci/dotnet:v1-runtime
FROM base:v1
WORKDIR /src
ONBUILD COPY . /src
ONBUILD make clean all
FROM runtime:v1
WORKDIR /app
ONBUILD COPY --from=build /src/target /app

We wanted to use # syntax = docker/dockerfile:1.0-experimental frontend for mount=type=cache options in our build container, but because COPY command is inside ONBUILD statement, buildkit requires to set experimental on main dockerfiles.

This is not very convenient, as we would have to update all our dockerfiles over all projects (which is avoided with the use of ONBUILD instructions).

Is there a workaroud for this? Maybe some kind of global option to set experimental frontend as default?

@tonistiigi
Copy link
Member

Sorry, don't understand this report. What's the difference compared to #816 ? The ONBUILD rule executes in the context of the importer. In what line do you want to use the cache mount?

@astorath
Copy link
Author

astorath commented Feb 7, 2019

Sorry, don't understand this report. What's the difference compared to #816 ? The ONBUILD rule executes in the context of the importer. In what line do you want to use the cache mount?

Well, I expect ONBUILD to be executed with frontend it was described (not in the context of importer) or to import the context from image to importer somehow...

@tonistiigi
Copy link
Member

The ONBUILD behavior is to basically just store the command string and put it into the importer image. This is the same reason why you need to redefine the build stage in the importer image if it was used in the ONBUILD COPY --from. You need it because what you are exporting is just a string and not an actual build graph. What you are asking is a new feature (that is actually possible with custom frontends) and likely a new syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants