Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 72b7d5a

Browse files
Update Homebrew script (#1416)
* Fix Homebrew installation Update the link to the core Homebrew repo used during installation. * Allow installing Homebrew using shallow clone as a feature * Fix typing error in _VSC_INSTALL_HOMEBREW args
1 parent 15204de commit 72b7d5a

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

script-library/container-features/src/devcontainer-features.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,11 @@
590590
"enum": ["latest"],
591591
"default": "latest",
592592
"description": "Currently unused."
593+
},
594+
"shallow": {
595+
"type": "boolean",
596+
"default": false,
597+
"description": "Use shallow clone for faster container build."
593598
}
594599
},
595600
"buildArg": "_VSC_INSTALL_HOMEBREW",

script-library/container-features/src/feature-scripts.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _VSC_INSTALL_JAVA="java-wrapper.sh ${_BUILD_ARG_JAVA_VERSION:-latest}"
1616
_VSC_INSTALL_GRADLE="gradle-debian.sh ${_BUILD_ARG_GRADLE_VERSION:-latest}"
1717
_VSC_INSTALL_MAVEN="maven-debian.sh ${_BUILD_ARG_MAVEN_VERSION:-latest}"
1818
_VSC_INSTALL_RUBY="ruby-debian.sh ${_BUILD_ARG_RUBY_VERSION:-latest}"
19-
_VSC_INSTALL_HOMEBREW=homebrew-debian.sh
19+
_VSC_INSTALL_HOMEBREW="homebrew-debian.sh automatic true ${_BUILD_ARG_HOMEBREW_SHALLOW:-false}"
2020
_VSC_INSTALL_RUST="rust-debian.sh /usr/local/cargo /usr/local/rustup automatic true false ${_BUILD_ARG_RUST_VERSION:-latest} ${_BUILD_ARG_RUST_PROFILE:-minimal}"
2121
_VSC_INSTALL_POWERSHELL="powershell-debian.sh ${_BUILD_ARG_POWERSHELL_VERSION:-latest}"
2222
_VSC_INSTALL_DESKTOP_LITE="desktop-lite-debian.sh automatic ${_BUILD_ARG_DESKTOP_LITE_PASSWORD:-vscode} true ${_BUILD_ARG_DESKTOP_LITE_VNCPORT:-5901} ${_BUILD_ARG_DESKTOP_LITE_WEBPORT:-6080}"

script-library/docs/homebrew.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ Or as a feature:
2020

2121
```json
2222
"features": {
23-
"homebrew": "latest"
23+
"homebrew": {
24+
"version": "latest",
25+
"shallow": false
26+
}
2427
}
2528
```
2629

2730
|Argument| Feature option |Default|Description|
2831
|--------|----------------|-------|-----------|
2932
|Non-root user| | `automatic`| Specifies a user in the container other than root that will use Homebrew. A value of `automatic` will cause the script to check for a user called `vscode`, then `node`, `codespace`, and finally a user with a UID of `1000` before falling back to `root`. |
3033
| Add to rc files flag | | `true` | A `true`/`false` flag that indicates whether the `PATH` should be updated via `/etc/bash.bashrc` and `/etc/zsh/zshrc`. |
31-
| Use shallow clone flag | | `false` | A `true`/`false` flag that indicates whether the script should install Homebrew using shallow clone. Shallow clone allows significantly reduce installation size at the expense of not being able to run `brew update` meaning the package index will be frozen at the moment of image creation. |
34+
| Use shallow clone flag | `shallow` | `false` | A `true`/`false` flag that indicates whether the script should install Homebrew using shallow clone. Shallow clone allows significantly reduce installation size at the expense of not being able to run `brew update` meaning the package index will be frozen at the moment of image creation. |
3235
| BREW_PREFIX | | `/home/linuxbrew/.linuxbrew` | Location to install Homebrew. Please note that changing this setting will prevent you from using some of the precompiled binaries and therefore isn't recommended. |
3336

3437
## Usage
@@ -39,7 +42,10 @@ You can use this script for your primary dev container by adding it to the `feat
3942

4043
```json
4144
"features": {
42-
"homebrew": "latest"
45+
"homebrew": {
46+
"version": "latest",
47+
"shallow": false
48+
}
4349
}
4450
```
4551

script-library/homebrew-debian.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ if [ "${USE_SHALLOW_CLONE}" = "false" ]; then
117117
echo "Installing Homebrew..."
118118
git clone https://github.com/Homebrew/brew "${BREW_PREFIX}/Homebrew"
119119
mkdir -p "${BREW_PREFIX}/Homebrew/Library/Taps/homebrew"
120-
git clone https://github.com/Homebrew/linuxbrew-core "${BREW_PREFIX}/Homebrew/Library/Taps/homebrew/homebrew-core"
120+
git clone https://github.com/Homebrew/homebrew-core "${BREW_PREFIX}/Homebrew/Library/Taps/homebrew/homebrew-core"
121121
else
122122
echo "Installing Homebrew with shallow clone..."
123123
git clone --depth 1 https://github.com/Homebrew/brew "${BREW_PREFIX}/Homebrew"
124124
mkdir -p "${BREW_PREFIX}/Homebrew/Library/Taps/homebrew"
125-
git clone --depth 1 https://github.com/Homebrew/linuxbrew-core "${BREW_PREFIX}/Homebrew/Library/Taps/homebrew/homebrew-core"
125+
git clone --depth 1 https://github.com/Homebrew/homebrew-core "${BREW_PREFIX}/Homebrew/Library/Taps/homebrew/homebrew-core"
126126
# Disable automatic updates as they are not allowed with shallow clone installation
127127
updaterc "export HOMEBREW_NO_AUTO_UPDATE=1"
128128
updatefishconfig "set -gx HOMEBREW_NO_AUTO_UPDATE 1"

0 commit comments

Comments
 (0)