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

Add support for ENV and CMD commands in Dockerfiles #1542

Closed
felipehuici opened this issue Apr 13, 2024 · 1 comment
Closed

Add support for ENV and CMD commands in Dockerfiles #1542

felipehuici opened this issue Apr 13, 2024 · 1 comment
Assignees
Labels
kind/enhancement New feature or request

Comments

@felipehuici
Copy link
Member

felipehuici commented Apr 13, 2024

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.

  1. Add new interface methods:

    Env() []string
    Args() []string // join ENTRYPOINT + CMD together
    Ports() []string // EXPOSE
    Volumes() []string // VOLUME
  2. Add the ExporterEntry and then parse the temporary archive using stereoscope such that we can access the Metadata object.

  3. Update all references where the Args are necessary.

  4. 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

@felipehuici felipehuici added the kind/enhancement New feature or request label Apr 13, 2024
@craciunoiuc craciunoiuc self-assigned this Apr 18, 2024
@craciunoiuc
Copy link
Member

This was done some time ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants