### Dockerfile Example with Multiple Installations Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md A comprehensive Dockerfile example demonstrating the installation of the feature-cli script followed by installing two different devcontainer features with options. ```Dockerfile RUN curl -fsSL https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_BIN_DIR=/bin bash \ && feature-install ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 \ && feature-install --features '{"ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4":{"tools":"ruff"}}' ``` -------------------------------- ### Install Single Feature Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Quick start example to install a single devcontainer feature from a specified OCI registry and tag. ```bash RUN feature-install ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 ``` -------------------------------- ### Run Feature Installer Test Suite Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Installs dependencies and runs the full test suite for the feature-installer using bats. Tests cover version consistency, dependency ordering, option conflicts, and install execution. ```bash # Install dependencies (Debian/Ubuntu) sudo apt-get install -y bats jq curl tar # Run the full suite bats test/feature-install.bats # Output (passing): # ✓ version matches VERSION # ✓ dependsOn order # ✓ installsAfter order # ✓ conflicting options fail # ✓ install order when running features # # 5 tests, 0 failures ``` -------------------------------- ### Install Features Using a Features File Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Install features by referencing a JSON file containing the features and their options. This can be a standard devcontainer.json with a `.features` key or a plain JSON file. ```bash feature-install --features-file /tmp/devcontainer.json ``` ```json // devcontainer.json (the .features object is extracted automatically) { "name": "My Dev Container", "features": { "ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4": {}, "ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4": { "tools": "ruff" } } } ``` ```bash # Plain JSON file (no .features wrapper) # features.json: # { # "ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4": {} # } feature-install --features-file features.json ``` -------------------------------- ### Check Feature Installer Version Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Prints the current version of the feature-install tool and exits. This is useful for verifying the installed version. ```bash feature-install --version # Output: 0.1.0 ``` -------------------------------- ### Install Features from devcontainer.json Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Installs devcontainer features by reading their configuration from a specified devcontainer.json file. ```bash RUN feature-install --features-file devcontainer.json ``` -------------------------------- ### Bootstrap feature-install CLI Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Installs the feature-install binary into a container image. Use FEATURE_CLI_BIN_DIR to control the install location. Override FEATURE_CLI_REPO and FEATURE_CLI_REF to specify a custom source repository and git ref. ```dockerfile FROM ubuntu:24.04 # Bootstrap: installs feature-install to /bin RUN curl -fsSL \ https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_BIN_DIR=/bin bash # Output: Installed feature-install to /bin/feature-install # Override repo/ref to pin a specific fork or commit RUN curl -fsSL \ https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_REPO=myorg/feature-installer \ FEATURE_CLI_REF=v0.1.0 \ FEATURE_CLI_BIN_DIR=/usr/local/bin bash ``` -------------------------------- ### Install Feature with Overridden Options Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Installs a devcontainer feature, overriding specific options. The installer exports merged options as uppercase environment variables to the install script. ```bash # User overrides "tools"; "pythonVersion" falls back to default "3.12" feature-install --features '{ "ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4": { "tools": "ruff" } }' # install.sh receives: # TOOLS=ruff # PYTHONVERSION=3.12 ``` -------------------------------- ### Dry-run Feature Installation Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Performs a dry run to determine the installation order of specified devcontainer features without actually installing them. ```bash RUN feature-install --dry-run ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 ``` -------------------------------- ### Install a Single Feature using Positional Argument Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Installs a single remote feature from an OCI registry. The tag is required. `oras` is auto-downloaded if not present. Multiple features can be installed in one invocation by listing them as positional arguments. ```dockerfile FROM ubuntu:24.04 RUN curl -fsSL \ https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_BIN_DIR=/bin bash # Install a single remote feature — tag is required RUN feature-install ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 # Output: # Installing feature: ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 # # Install multiple features in one invocation (positional args) RUN feature-install \ ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 \ ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4 ``` -------------------------------- ### Pre-install oras for Dockerfile Builds Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Demonstrates pre-installing the 'oras' binary in a Dockerfile to avoid auto-download during feature installation. Sets the ORAS_BIN environment variable to point to the pre-installed binary. ```dockerfile FROM ubuntu:24.04 # Pre-install oras to avoid auto-download on every build RUN curl -fsSL https://github.com/oras-project/oras/releases/download/v1.1.0/oras_1.1.0_linux_amd64.tar.gz \ | tar -xz -C /usr/local/bin oras RUN curl -fsSL https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh | FEATURE_CLI_BIN_DIR=/bin bash # Point feature-install at the pre-installed binary ENV ORAS_BIN=/usr/local/bin/oras RUN feature-install ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 ``` -------------------------------- ### Install feature-cli Script Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Installs the feature-cli script into the /bin directory. Run this only inside containers (Dockerfile build or devcontainer image build). ```bash RUN curl -fsSL https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_BIN_DIR=/bin bash ``` -------------------------------- ### Install Multiple Features with Options Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Installs multiple devcontainer features, specifying options for each. Options are provided as a JSON object where keys are feature identifiers and values are their respective option objects. ```bash RUN feature-install --features '{ \ "ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4": {}, \ "ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4": {"tools":"ruff"} \ }' ``` -------------------------------- ### Install Features Using Local Paths Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Install features by referencing local directories. The tool automatically converts relative or absolute paths to absolute paths. This is useful for testing features in development or monorepos. ```bash # Absolute path feature-install /workspace/features/my-feature ``` ```bash # Relative paths feature-install ./src/system-tools ./src/python-tools ``` ```bash # Mix of local and remote in JSON feature-install --features '{ "./src/system-tools": {}, "ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4": {} }' ``` ```plaintext # Local feature devcontainer-feature.json layout expected: # src/system-tools/ # ←← devcontainer-feature.json # ←← install.sh ``` -------------------------------- ### Soft Ordering Constraint with installsAfter Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Use `installsAfter` to specify that a feature should be installed after another *if* the other feature is already selected. It does not auto-add features. The installer incorporates these constraints into the topological sort. ```json // test/fixtures/ia-c/devcontainer-feature.json { "id": "ia-c", "version": "0.0.1", "name": "ia-c", "description": "installsAfter dependent", "installsAfter": ["../ia-b"], "options": {} } ``` ```bash # ia-c declares installsAfter ia-b; when both are selected ia-b runs first feature-install --dry-run ./test/fixtures/ia-b ./test/fixtures/ia-c ``` ```bash # If ia-b is NOT in the selected set, ia-c still installs (constraint is ignored) feature-install --dry-run ./test/fixtures/ia-c ``` -------------------------------- ### Install Features from Local Paths Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Installs devcontainer features directly from local file paths. This is useful for development or testing custom features. ```bash RUN feature-install ./src/system-tools ./src/python-tools ``` -------------------------------- ### Install Features with Options using --features Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Accepts a JSON object mapping feature references to their option objects. Options override defaults declared in each Feature's `devcontainer-feature.json`. Option keys are sanitized to uppercase environment variable names before being exported to `install.sh`. ```dockerfile FROM ubuntu:24.04 RUN curl -fsSL \ https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_BIN_DIR=/bin bash # Pass options as inline JSON RUN feature-install --features '{ "ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4": {}, "ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4": {"tools": "ruff"} }' # install.sh for python-tools receives: TOOLS=ruff # Escape quotes when used inside a single RUN string RUN feature-install --features "{\"ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4\":{\"tools\":\"ruff\"}}" ``` -------------------------------- ### Install Features from a File using --features-file Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Reads feature references and options from a `devcontainer.json` (extracts the `.features` key) or a plain JSON object file. This is useful when reusing an existing devcontainer configuration for standalone image builds. ```dockerfile FROM ubuntu:24.04 COPY .devcontainer/devcontainer.json /tmp/devcontainer.json RUN curl -fsSL \ https://raw.githubusercontent.com/milkclouds/devcontainer-feature-installer/main/install-feature-cli.sh \ | FEATURE_CLI_BIN_DIR=/bin bash ``` -------------------------------- ### Dry-Run Mode for Dependency Resolution Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Use `--dry-run` to resolve the dependency graph and display the install order without executing any installations. This is useful for validating dependencies and detecting conflicts. ```bash # Dry-run a single remote feature (resolves dependsOn transitively) feature-install --dry-run ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4 ``` ```bash # Dry-run local fixtures to inspect ordering feature-install --dry-run ./test/fixtures/dep-a ``` ```bash # Dry-run with --features JSON feature-install --dry-run --features '{ "ghcr.io/milkclouds/devcontainer-features/system-tools:0.1.4": {}, "ghcr.io/milkclouds/devcontainer-features/python-tools:0.1.4": {} }' ``` -------------------------------- ### Define Feature Options in devcontainer-feature.json Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Defines available options for a devcontainer feature, including their type and default values. These options can be overridden during installation. ```json { "id": "python-tools", "version": "0.1.4", "options": { "tools": { "type": "string", "default": "pip" }, "pythonVersion": { "type": "string", "default": "3.12" } } } ``` -------------------------------- ### Automatic Dependency Resolution with dependsOn Source: https://context7.com/milkclouds/devcontainer-feature-installer/llms.txt Declare `dependsOn` in `devcontainer-feature.json` for automatic dependency resolution. The installer builds a dependency graph and sorts features topologically. Conflicts in options for the same dependency will cause failure. ```json // test/fixtures/dep-a/devcontainer-feature.json { "id": "dep-a", "version": "0.0.1", "name": "dep-a", "description": "Dependency A", "dependsOn": { "../dep-b": {} }, "options": {} } ``` ```bash # dep-b is installed automatically before dep-a feature-install ./test/fixtures/dep-a ``` ```bash # Conflict detection: dep-a requires conflict-e with opt=1, # but the caller also passes opt=2 → hard failure feature-install --features '{ "./test/fixtures/conflict-e": {"opt": "2"}, "./test/fixtures/conflict-a": {} }' ``` -------------------------------- ### Run Bats Tests Source: https://github.com/milkclouds/devcontainer-feature-installer/blob/main/README.md Executes the test suite for the feature-install project using the Bats testing framework. ```bash bats test/feature-install.bats ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.