Skip to content

proposal: Support ARG --description flag for inline build argument documentation #765

Description

@janishorsts

Use case

Modern Dockerfile and BuildKit specifications (Dockerfile v1.8+) support the --description flag on ARG instructions:

ARG --description="Target binary release version" VERSION=1.0.0

Earthfile currently supports --required and --global options on ARG (earthfile.abnf:L308), but lacks explicit --description="..." support.

Adding ARG --description="..." to Earthfile will allow recipe authors to document build arguments directly in code, improving developer experience and integrating seamlessly with EarthBuild's CLI documentation tool (earth doc), which inspects target argument descriptions.


Expected Behavior

Usage in Earthfiles

build:
    ARG --description="Environment stage (dev, staging, prod)" ENV=prod
    ARG --required --description="Database connection URL" DB_URL

    FROM alpine:3.18
    RUN echo "Building for ${ENV}"

CLI Documentation Integration (earth doc)

earth doc +build automatically renders argument descriptions provided via --description="...".


Grammar Specification (earthfile.abnf)

Update arg-option in internal/earthfile/earthfile.abnf:

arg-option          = "--required" / "--global" / ( "--description" "=" ( WORD / QUOTED-STRING ) )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

EarthfileEarthfile parser and syntax proposalsproposal

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions