coder / envbuilder

Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly.
Apache License 2.0
142 stars 26 forks source link

question: Ability to add features and/or modify feature parameters #265

Open phorcys420 opened 3 months ago

phorcys420 commented 3 months ago

Hello everyone,

I'm looking for a way to add/edit a feature based on input from a coder_parameter.

Use-case is for example asking a user "Do you want to have a desktop ?" and adding the desktop-lite based on that.


Is there anything currently preventing me to do so or is there a flag/env variable I can pass to the CLI ? I'm currently using my own template based on devcontainer-docker

matifali commented 3 months ago

one way to do it is to have multiple devcontainer.json files and set the ENVBUILDER_DEVCONTAINER_JSON_PATH and ENVBUILDER_DEVCONTAINER_DIR conditionally. Otherwise, I do not see a dynamic way to edit the devcontainer.json on the fly.

I guess devcontainer-cli also does not support this. (I know devcontainer vscode extension does support adding features interactively)

Can we support this with a coder-envbuilder extension that allows rebuilding the image and adds/removes features (Haven't thought about how it will work yet). cc: @kylecarbs @code-asher

phorcys420 commented 2 months ago

one way to do it is to have multiple devcontainer.json files and set the ENVBUILDER_DEVCONTAINER_JSON_PATH and ENVBUILDER_DEVCONTAINER_DIR conditionally. Otherwise, I do not see a dynamic way to edit the devcontainer.json on the fly.

I see, this isn't that great but should work. I don't really see a better way, I'm pretty much asking for dynamically generating devcontainer.json files from coder_parameters, maybe this is out-of-scope for this project.


Apparently DevContainer Templates are a thing, and "Option Resolution" seems to do part of what I'm looking for.

cc: @matifali

phorcys420 commented 2 months ago

Actually, DevContainer Templates are only meant for template administrators bootstrapping their templates, not for end-user customization.