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

Feature Request - Rendering Dockerfile #108

Closed
ali-tayebi opened this issue Sep 16, 2019 · 3 comments
Closed

Feature Request - Rendering Dockerfile #108

ali-tayebi opened this issue Sep 16, 2019 · 3 comments
Assignees
Milestone

Comments

@ali-tayebi
Copy link

Feature Proposal
Would be great to add a feature to render Dockerfile and docker-compose file.

Use-case
It provides generating and updating Dockerfiles using code. It helps to automate these tasks. Great for applying consistency to multiple project and services, e.g. microservices.

Implementation
Would be limited to FileBuilder with making the RenderDockerfile public.
Also, RenderDockerfileAsString() can be added to facilitate automated testing.

Actions
I am happy to raise the PR as soon as the maintainers have approved the proposal.

I couldn't find any documentation about contributing so I just raise it here

@mariotoffia mariotoffia added enhancement under-investigation A investigation is made around the issue labels Sep 17, 2019
@mariotoffia mariotoffia added this to the 3.0.0 milestone Sep 17, 2019
@mariotoffia
Copy link
Owner

mariotoffia commented Sep 17, 2019

That's a really good idea. I think a good approach would be to "detach" the FileBuilder from the ImageBuilder. For example we could strip out all around ImageBuilder in the FileBuilder and create a subclass e.g. ImageFileBuilder where it's constructor is internal (where the FileBuilder constructor is still internal) and only handle image related in the derived class such as

   public IContainerImageService Build()
    {
      return _parent.Build();
    }

Where the FileBuilder would build the docker string. Thus it will be possible to use the FileBuilder without required to build a image of it directly. I will do the same with the docker-compose builder (I'm still in progress of creating all the models).

To access the "public" FileBuilder we can bind it into the Fd class along the way of...

using (var dockerfile = Fd.DockerFile(/*empty ctor - string only*/)) // ... 

What do you think about that?

Cheers,
Mario

@ali-tayebi
Copy link
Author

It makes a perfect sense to me.

@mariotoffia mariotoffia removed the under-investigation A investigation is made around the issue label Oct 10, 2019
mariotoffia pushed a commit that referenced this issue Nov 1, 2019
This is to assist unittest and solves Issue #108.
mariotoffia pushed a commit that referenced this issue Nov 1, 2019
FileBuilder now supports to do everything is it will for the ImageBuilder without the need to use the image builder. It is then possible to use command to build the dockerfile or other custom functionality.
mariotoffia pushed a commit that referenced this issue Nov 1, 2019
[Fix] Liner ordering needs to be strict in FileBuilder.

It also addresses Issue #108 where a Dockerfile can be produced as a string without ImageBuilder is involved to actually build it.
@mariotoffia
Copy link
Owner

fixed - will be released in next release.

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

No branches or pull requests

2 participants