Skip to content

build: variables (arg, env)#19386

Merged
dvdksn merged 4 commits intodocker:mainfrom
dvdksn:build-variables
Feb 20, 2024
Merged

build: variables (arg, env)#19386
dvdksn merged 4 commits intodocker:mainfrom
dvdksn:build-variables

Conversation

@dvdksn
Copy link
Copy Markdown
Contributor

@dvdksn dvdksn commented Feb 13, 2024

Proposed changes

Adds a new manuals page about build variables (arg, env) highlighting their differences and use.

https://deploy-preview-19386--docsdocker.netlify.app/build/building/variables/

  • config: add example node version
  • config: fix incorrect example version for alpine
  • build: add "build variables" page

Related issues (optional)

@netlify /build/building/variables/

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@github-actions github-actions Bot added area/build Relates to Dockerfiles or docker build command hugo Updates related to hugo labels Feb 13, 2024
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 13, 2024

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit b5032e1
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/65d46a1f48f1150008d705c8
😎 Deploy Preview https://deploy-preview-19386--docsdocker.netlify.app/build/building/variables
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dvdksn dvdksn marked this pull request as ready for review February 13, 2024 09:47
@dvdksn dvdksn requested a review from crazy-max as a code owner February 13, 2024 09:47
@dvdksn dvdksn force-pushed the build-variables branch 2 times, most recently from 383e5e4 to 60eb76e Compare February 13, 2024 09:52
Comment thread content/build/building/env-vars.md
Comment thread content/build/building/variables.md Outdated
Comment thread content/build/building/variables.md
Comment thread content/build/building/variables.md Outdated
Comment thread content/build/building/variables.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Wanted to reply on slack but didn't get to that. I wonder if we could come up with a slightly modified example where the "breakpoint" stages are consecutive in the Dockerfile, i.e. (trying to give it my best ASCII-art here);

FROM alpine:${VERSION} AS stage-1
ARG HELLO=hello
RUN echo $HELLO

..................................

# stage-1-a is a continuation of stage-1, and therefore inherits build-args
# that are defined in it. This stage can be used as a "break-point" within
# the stage-1 stage.
FROM stage-1 AS stage-1-a
ARG WORLD=world
RUN echo $HELLO $WORLD

..................................

# similarly, stage-1-b is a continuation of stage-1-a, and can act as
# another break-point in stage-1 for debugging purposes.
FROM stage-1-a AS stage-1-b
RUN echo $HELLO $WORLD

In the above, we could put all of the stage-1-xxx in a single "box", but with a dotted separator between them perhaps.

Comment thread content/build/building/variables.md
Comment thread content/build/building/variables.md
@dvdksn
Copy link
Copy Markdown
Contributor Author

dvdksn commented Feb 15, 2024

any blocking issues with this one @thaJeztah or @crazy-max. The illustration could maybe be prettier but I think it gets the message across.

@dvdksn dvdksn requested a review from a team February 15, 2024 12:07
Comment thread content/build/building/variables.md Outdated
Comment thread content/build/building/variables.md Outdated

### BUILDKIT_HOST

_Introduced in [Buildx v0.9.0](../release-notes.md#090)_
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: I've started using a note to do the same thing with Compose.
> Available in ....etc
Perhaps we should agree on a format going forward for the sake of consistency? Which is better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we definitely should standardize this. I think we should probably have a shortcode for it like k8s does with feature_state. That would also let us have more control over rendering, and better structure the parameters (possibly even let us specify and test for old versions to be cleaned up after a while). Maybe for a follow-up?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 sounds good to me

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"+1" on having this kind of information in a more structured form.

I recall we discussed this at some point, and know we have the "API version" annotations for some options, e.g.;

Screenshot 2024-02-20 at 11 06 40

For those we (used to? still have?) a configurable "threshold", which allows use to conditionally render those badges. That way, we can keep the metadata (added in version X), but can decide whether it's still relevant to highlight/show (e.g., highlighting a feature that was added 6 or 7 years ago is no longer very informative).

If we have specific criteria, we could also use that information to automatically render "new" / "what's new" badges, such as what's being added in #19444 (add a "new" badge because it was added for Docker Desktop 4.28, but once we are a couple of version(s) along, we can hide that).

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn dvdksn merged commit 3d7c837 into docker:main Feb 20, 2024
@dvdksn dvdksn deleted the build-variables branch February 20, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Relates to Dockerfiles or docker build command hugo Updates related to hugo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants