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 in FileBuilder #177

Closed
macsux opened this issue Mar 16, 2021 · 6 comments · Fixed by #180
Closed

Add support for ENV in FileBuilder #177

macsux opened this issue Mar 16, 2021 · 6 comments · Fixed by #180
Assignees
Labels
enhancement waiting-for-feedback Waiting for someone to give feedback until this issue can be brought further.
Milestone

Comments

@macsux
Copy link

macsux commented Mar 16, 2021

When building up image definition via FileBuilder, should allow defining Dockerfile ENV directive

@mariotoffia mariotoffia self-assigned this Mar 17, 2021
@mariotoffia mariotoffia added enhancement under-development Denotes that a issue is under development but not yet released. labels Mar 17, 2021
@mariotoffia mariotoffia added this to the 3.0.0 milestone Mar 17, 2021
mariotoffia added a commit that referenced this issue Mar 17, 2021
ENV, ARG, ENTRYPOINT, LABEL, USER, VOLUME
mariotoffia added a commit that referenced this issue Mar 17, 2021
ENV, ARG, ENTRYPOINT, LABEL, USER, VOLUME.
Also support for the new parameters on FROM, COPY.
@mariotoffia
Copy link
Owner

I've compiled a pre-release - please have a go https://www.nuget.org/packages/Ductus.FluentDocker/2.8.8-beta.14

@mariotoffia mariotoffia added waiting-for-feedback Waiting for someone to give feedback until this issue can be brought further. and removed under-development Denotes that a issue is under development but not yet released. labels Mar 17, 2021
@mariotoffia mariotoffia reopened this Mar 17, 2021
@mariotoffia
Copy link
Owner

@macsux Please report back if it works or if you have any issues.

@macsux
Copy link
Author

macsux commented Mar 22, 2021

ENV is awkward to work with, and can't chain multiple values into one command easily. I propose something like this:

        class EnvCommand : ICommand
        {
            public Dictionary<string, string> Values { get; }

            public EnvCommand(Dictionary<string, string> values)
            {
                Values = values ?? new();
            }

            public override string ToString()
            {
                return $"ENV {string.Join(" \\\n    ", Values.Select(x => $"{x.Key}={x.Value}"))}";
            }
        }
        public FileBuilder Environment(this FileBuilder builder, Dictionary<string, string> values)
        {
            _config.Commands.Add(new EnvCommand(values));
            return builder;
        }

@mariotoffia
Copy link
Owner

I don't quite follow you - what is the problem with this?

new EnvCommand(
          "MY_ENV=a env",
          "NEXT_ENV=next var",
          "PASSWORD=DbPass-for-admin"
);

@macsux
Copy link
Author

macsux commented Mar 22, 2021 via email

@mariotoffia
Copy link
Owner

mariotoffia commented Mar 22, 2021

Yes, but it is how the other env API already work

e.g. public CompositeBuilder WithEnvironment(params string[] nameValue), public ContainerBuilder WithEnvironment(params string[] nameValue), ...

  • added to v2 list of changes - for v1 the name nameValue has to suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement waiting-for-feedback Waiting for someone to give feedback until this issue can be brought further.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants