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

Proposal: Global ARGs #593

Closed
vladaionescu opened this issue Dec 7, 2020 · 1 comment
Closed

Proposal: Global ARGs #593

vladaionescu opened this issue Dec 7, 2020 · 1 comment
Assignees
Labels
help:feedback-requested Issue requests feedback type:proposal A proposal for a new feature

Comments

@vladaionescu
Copy link
Member

vladaionescu commented Dec 7, 2020

Background

@ido-namely reports on Gitter:

I have different targets building different images, and I'd like them all to use the same docker registry address.

I was hoping that ARG can be shared

ARG TST="hello world"
FROM golang:1.13-alpine3.11

test-target:
    ARG TST
    RUN echo $TST

Proposal

  • All args declared in the +base target are "global" ARGs. Meaning that they are passed throughout the other targets even if they don't inherit from +base. So the following should print "hello world":
ARG TST="hello world"
FROM golang:1.13-alpine3.11

test-target:
    RUN echo $TST

Possible future extension

Could perhaps prevent this behavior if needed with a ARG --local TST="hello world"

Alternatives considered

  • A possibility might be that ARGs declared in the +base target are global and shared with the rest of the targets, if there is no FROM and they inherit automatically from +base. This would be inconsistent when chaining targets.
  • Another option could be to always propagate build args too on a FROM. This may be deviating too much from Dockerfile behavior.
  • Yet another option is to have a special arg ARG --global for such situations.
@vladaionescu
Copy link
Member Author

In v0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:feedback-requested Issue requests feedback type:proposal A proposal for a new feature
Projects
No open projects
Development

No branches or pull requests

1 participant