Skip to content

Commit 48d5311

Browse files
bamurtaughChuxel
andauthored
Update features.md (#30)
* Update features.md * Update _implementors/features.md Co-authored-by: Chuck Lantz <[email protected]> Co-authored-by: Chuck Lantz <[email protected]>
1 parent c60ea62 commit 48d5311

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

_implementors/features.md

+10
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ _For information on distribution features, see [the dev container features distr
165165

166166
## <a href="#execution" name="execution" class="anchor"> Execution </a>
167167

168+
### <a href="#invoking-installsh" name="invoking-installsh" class="anchor"> Invoking `install.sh` </a>
169+
170+
The `install.sh` script for each Feature should be executed as `root` during a container image build. This allows the script to add needed OS dependencies or settings that could not otherwise be modified. This also allows the script to switch into another user's context using the `su` command (e.g., `su ${USERNAME} -c "command-goes-here"`). In combination, this allows both root and non-root image modifications to occur even if `sudo` is not present in the base image for security reasons.
171+
172+
To ensure that the appropriate shell is used, the execute bit should be set on `install.sh` and the file invoked directly (e.g. `chmod +x install.sh && ./install.sh`).
173+
174+
> **Note:** It is recommended that Feature authers write `install.sh` using a shell available by default in their supported distributions (e.g., `bash` in Debian/Ubuntu or Fedora, `sh` in Alpine). In the event a different shell is required (e.g., `fish`), `install.sh` can be used to boostrap by checking for the presence of the desired shell, installing it if needed, and then invoking a secondary script using the shell.
175+
>
176+
> The `install.sh` file can similarly be used to bootstrap something written in a compiled language like Go. Given the increasing likelihood that a Feature needs to work on both x86_64 and arm64-based devices (e.g., Apple Silicon Macs), `install.sh` can detect the current architecture (e.g., using something like `uname -m` or `dpkg --print-architecture`), and then invoke the right executable for that architecture.
177+
168178
### <a href="#installation-order" name="installation-order" class="anchor"> Installation order </a>
169179

170180
By default, Features are installed on top of a base image in an order determined as optimal by the implementing tool.

0 commit comments

Comments
 (0)