chore!: deprecate homebrew, remove ruby install

Homebrew is deprecated and will be removed at the end of March 2023.

Homebrew reinstalls the bundled ruby if it's unavailable, so this helps
us save space in the short term until Homebrew is removed.
This commit is contained in:
Dean Sheather 2023-02-15 04:37:29 +00:00
parent e6f03c8b73
commit 214fa19aed
3 changed files with 38 additions and 2 deletions

View File

@ -52,4 +52,13 @@ USER coder
# install Homebrew, must be as a non-root user
RUN HOMEBREW_INSTALL_FROM_API=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
ENV PATH /home/linuxbrew/.linuxbrew/bin:${PATH}
USER ROOT
# install our deprecation message wrapper for homebrew
COPY --chown=root:root --chmod=755 homebrew-wrapper.sh /usr/local/bin/brew
# remove the bundled ruby from homebrew to save space, homebrew reinstalls
# anyways
RUN rm -rf /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby
USER CODER

View File

@ -60,4 +60,13 @@ USER coder
# install Homebrew, must be as a non-root user
RUN HOMEBREW_INSTALL_FROM_API=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
ENV PATH /home/linuxbrew/.linuxbrew/bin:${PATH}
USER ROOT
# install our deprecation message wrapper for homebrew
COPY --chown=root:root --chmod=755 homebrew-wrapper.sh /usr/local/bin/brew
# remove the bundled ruby from homebrew to save space, homebrew reinstalls
# anyways
RUN rm -rf /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby
USER CODER

View File

@ -0,0 +1,18 @@
#!/bin/sh
brew_bin="/home/linuxbrew/.linuxbrew/bin/brew"
prefix="WARNING: "
if [ -t 1 ]; then
# If stdout is a terminal, use color.
prefix="\033[1;33m${prefix}\033[0m"
fi
warning() {
echo "${prefix}Homebrew in Coder images is deprecated and will be removed at the end of March 2023." 1>&2
}
warning
echo
"$brew_bin" "$@"
echo
warning