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

Reinitialized ARG variable resolves to an ENV variable declared at the top of the Dockerfile #42

Closed
rcjsuen opened this issue May 29, 2018 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented May 29, 2018

ENV ver=latest
FROM busybox:$ver
ARG ver
RUN echo $ver

Although this Dockerfile doesn't make much sense and won't actually build, we shouldn't resolve the $ver variable to latest since it's not an ARG that's defining the variable.

import { DockerfileParser } from 'dockerfile-ast';

const content = 
`ENV ver=latest
FROM busybox:$ver
ARG ver
RUN echo $ver`;

let dockerfile = DockerfileParser.parse(content);
console.log(dockerfile.resolveVariable("ver", 3));
latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant