Skip to content

Commit 85506cf

Browse files
Chuxeljkeech
andauthored
Add more information on how install.sh should be invoked, used (#94)
Co-authored-by: John Keech <[email protected]>
1 parent ab3b454 commit 85506cf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

proposals/devcontainer-features.md

+10
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ _For information on distribution features, see [devcontainer-features-distributi
155155

156156
## Execution
157157

158+
### Invoking `install.sh`
159+
160+
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.
161+
162+
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`).
163+
164+
> **Note:** It is recommended that Feature authors 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.
165+
>
166+
> 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.
167+
158168
### Installation order
159169

160170
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)