genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.9k stars 231 forks source link

Add --push and --load support to build cmd #367

Open jossemargt-cto-ai opened 8 months ago

jossemargt-cto-ai commented 8 months ago

Problem statement

I found myself in the situation where I needed to give my users a migration path from img to docker + buildkit, which roughly translates into adding support to the --push, --load and --output=type=registry flags.

I'm well aware this project is not longer maintained, as per expressed in #348; however, I wanted to put this PR out there in case someone else stumbles with a similar situation.

Changeset Description

In summary, this quick patch allows img to rehash buildkit's output attributes based on the new flags presence.

The last statemet stands true with the only exception for the --load flag, which I preferred to add as a dummy one since img already simulates a docker registry through its own implementation. However, if we need a fully complaint solution I would suggest to incoporate #327 first, then add the proper behavior to this flag (dump resulting tar in STDOUT and pipe it again through STDIN as separate process).