-
Notifications
You must be signed in to change notification settings - Fork 212
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
Feat: Add cli flag for use template dockerfile as is #2802
Comments
Hey @alekseybb197 - thanks for bringing this up!
When you add this to your |
Hi @schristoff ! I suggest a way to completely eliminate dockerfile generation. And instead use the template without modification. My suggestion only applies to the build phase. It is then that the image is assembled, which uses references to external artifacts helm, kubectl and distribution packages. I built a porter with my fix #2803 and we are now successfully using it on our pipelines. The assembly is done using only resources within our network. Here is an example of a typical build template with the helm mixin: # syntax=docker.artifacts.examples.com/tools/dockerfile-upstream:1.4.0 ARG BUNDLE_DIR # code placeholder. insert here! RUN curl -LO https://artifactory.artifacts.examples.com:443/artifactory/tools/kubernetes/v1.26.0/kubectl && RUN rm -rf /var/lib/apt/lists COPY --link . ${BUNDLE_DIR} RUN rm ${BUNDLE_DIR}/porter.yaml Maybe I didn't describe the problem accurately. Please excuse me. Ready to fix. |
And this is an example of pipeline code
Autobuild-disabled is mandatory in this case! |
Would you be willing to discuss this feature at the community meeting next Thursday? I think it would be great for us all to come together and get a shared understanding on this! (Or whatever Thursday you make be available) |
Thanks @schristoff ! One day ) I am now able to allocate a limited amount of time to work on this project. Regrettably, not regularly. |
There is a lot of focus on Supply Chain Security and having options for bypassing the (somewhat opinionated) Dockerfile generated by Porter could be useful in situations where more control of the generated image is required. Having a dedicated CLI flag for using the Dockerfile template as-is may not be the best way and I propose using the experimental flag capability instead (which means we can control it on the command-line or use environment variables). Somewhere down the road we may get an awesome multi-arch, multi-stage setup that removes the need for the override capability.. 🤞 One use case that I'm currently prototyping is the possibility to reduce the size of the produced invocation images - which is nice when doing air-gapped bundles (others may not care as OCI layers also can be used for minimizing storage consumption in registries). This can be quickly demonstrated by taking the
The resulting invocation image:
(disclaimer, some of the mixins have runtimes for Windows and Linux included - thus inflating the size a bit in this example) Looking at the layers we see:
If an override was possible one could produce a multi-stage that flattens the image, snip from custom Dockerfile
Which results in a way smaller image:
Disclaimer: I'm not privy to the information on why the PR produced by @alekseybb197 was axed - but maybe it's time to reconsider if this functionality could be "MVP" while moving towards "the correct solution" |
Thank you, @jarnfast ! That's roughly how we reasoned when we promoted this solution. We also solved problems in unnecessary duplication within cnab. This code was handled not by me, but by Sergey Permyakov https://github.com/PowerStateFailure. Next is a typical dockerfile
In addition I also created a PoC distroless invocation image |
Is your feature request related to a problem? Please describe.
I use porter in my work. And I'm having trouble on a number of occasions:
In all of the above cases, it is required to significantly rewrite the final Dockerfile for the invocation image. However, the current code does not allow this.
The Dockerfile is currently being built in pkg/build/dockerfile-generator.go.
Variables, some of which are hardcoded, are defined in pkg/build/build.go.
Common problems:
Describe the solution you'd like
To solve these problems, I think it will be enough to add a command line flag that will override the default behavior. The default mode will use the old way of creating a call image, and if you specify a custom mode, the custom template will be used as is.
The text was updated successfully, but these errors were encountered: