kraftkit
kraftkit copied to clipboard
Add support for ENV and CMD commands in Dockerfiles
Feature request summary
Right now the ENV and CMD commands in Dockerfiles are ignored by kraft cloud deploy. The idea is to add support for these, essentially:
- ENV --> Map to kraft cloud deploy's -e flag
- CMD --> Use it to override the Kraftfile's cmd line (it one such line exists)
We introduce an additional ExporterEntry
(type OCI) which saves the OCI artifact to a temporary location, then unpack the output tarball and read in config.json
which contains all the information we want.
The issue is that this is embedded in function is part of a general interface which is only concerned about the generation of a rootfs and not any additional metadata. (Handling serializing directories in to CPIO archives, reading existing CPIO archives, and turning Dockerfiles into CPIO archives is its main purpose).
The generation of the rootfs is done at lots of different points throughout the project, depending on what you invoke, which is why we have this. Once solution could be to update the Initrd
interface to handle these additional metadata attributes, which would ultimately return empty for other source inputs (directory, existing cpio archives, etc.). This would be the quickest solution.
-
Add new interface methods:
Env() []string Args() []string // join ENTRYPOINT + CMD together Ports() []string // EXPOSE Volumes() []string // VOLUME
-
Add the
ExporterEntry
and then parse the temporary archive using stereoscope such that we can access theMetadata
object. -
Update all references where the Args are necessary.
-
Similar to the readme work, propagate this info back to our OCI image
Note, we should NOT automatically map ports or create volumes. This is not how docker behaves, it is only acting as a reference.
Describe alternatives
No response
Related architectures
None
Related platforms
None
Additional context
No response