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

Update the parsed object and generate an updated Dockerfile #49

Open
AntoninSlejska opened this issue Jan 11, 2019 · 1 comment
Open

Comments

@AntoninSlejska
Copy link

I need to edit Dockerfiles in a Javascript application. This library enables to parse the Dockerfiles, but I do not know, how to update the arguments.

E.g. I can get the argument for the 'FROM' instruction:

for (let instruction of instructions) {
  if (instruction.getInstruction() === 'FROM') {
    console.log(instruction.getArgumentsContent());   // 'ubuntu'
  }
}

How can I change the instruction 'FROM ubuntu' to 'FROM debian'?

And will then the method 'dockerfile.document.getText()' return the updated Dockerfile or the original? I need to be able to generate an updated Dockerfile.

Thanks.

@rcjsuen
Copy link
Owner

rcjsuen commented Jan 12, 2019

Hi, @AntoninSlejska. Thank you for your interest in this project.

Unfortunately, this project only parses Dockerfiles at the moment. It is not possible to alter the contents of the parsed Dockerfile.

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