From e5a20dedc35eb4c71b41217038ace2d036804b92 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Mon, 4 May 2020 01:38:03 +0200 Subject: [PATCH 1/4] Support installing tools via homebrew --- Dockerfile | 16 +++++++++++++++- included_software.md | 5 +++++ run-build-functions.sh | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2936a161..962c7f18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ emacs25-nox \ esl-erlang \ expect \ + file \ fontconfig \ fontconfig-config \ g++ \ @@ -468,7 +469,6 @@ ENV DOTNET_ROOT "/opt/buildhome/.dotnet" #populate local package cache RUN dotnet new - ################################################################################ # # Swift @@ -482,6 +482,20 @@ ENV PATH "$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH" RUN swiftenv install ${NETLIFY_BUILD_SWIFT_VERSION} RUN swift --version +################################################################################ +# +# Homebrew +# +################################################################################ +USER buildbot +RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +ENV PATH "/opt/buildhome/.linuxbrew/bin:$PATH" +ENV HOMEBREW_PREFIX "/opt/buildhome/.linuxbrew" +ENV HOMEBREW_CELLAR "/opt/buildhome/.linuxbrew/Cellar" +ENV HOMEBREW_REPOSITORY "/opt/buildhome/.linuxbrew/Homebrew" +ENV HOMEBREW_CACHE "/opt/buildhome/.homebrew-cache" +RUN brew tap homebrew/bundle + WORKDIR / # Cleanup diff --git a/included_software.md b/included_software.md index 565a1370..c67aa72c 100644 --- a/included_software.md +++ b/included_software.md @@ -72,3 +72,8 @@ The specific patch versions included will depend on when the image was last buil * [Doxygen](http://www.doxygen.org) - 1.8.6 * [WASMER](https://github.com/wasmerio/wasmer) * [WAPM](https://github.com/wasmerio/wapm-cli) + +* [Homebrew](https://brew.sh/) + - Any linux formula is supported: https://formulae.brew.sh/formula-linux/ + - Formulae from a `Brewfile` are installed automatically via [`brew bundle`](https://github.com/Homebrew/homebrew-bundle#readme) + - `HOMEBREW_BUNDLE_FILE` is respected diff --git a/run-build-functions.sh b/run-build-functions.sh index 660d5adc..a31e225b 100755 --- a/run-build-functions.sh +++ b/run-build-functions.sh @@ -54,6 +54,7 @@ mkdir -p $NETLIFY_CACHE_DIR/.composer mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gopath mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gocache mkdir -p $NETLIFY_CACHE_DIR/.wasmer/cache +mkdir -p $NETLIFY_CACHE_DIR/.homebrew-cache : ${YARN_FLAGS=""} : ${NPM_FLAGS=""} @@ -664,6 +665,12 @@ install_dependencies() { rm -rf $GOPATH/src/$GO_IMPORT_PATH ln -s /opt/buildhome/repo ${GOPATH}/src/$GO_IMPORT_PATH fi + + # Homebrew from Brewfile + if [ -f Brewfile ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ] + then + brew bundle + fi } # @@ -686,6 +693,7 @@ cache_artifacts() { cache_home_directory ".boot" "boot dependencies" cache_home_directory ".composer" "composer dependencies" cache_home_directory ".wasmer/cache", "wasmer cache" + cache_home_directory ".homebrew-cache", "homebrew cache" # Don't follow the Go import path or we'll store # the origin repo twice. From e07723b3423cbdb3a10e1783893f87a143fa1d27 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Mon, 4 May 2020 02:08:21 +0200 Subject: [PATCH 2/4] Move brew install before all other dependencies Mainly for allowing native node modules to use homebrew stuff --- run-build-functions.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/run-build-functions.sh b/run-build-functions.sh index a31e225b..6c4d7eb0 100755 --- a/run-build-functions.sh +++ b/run-build-functions.sh @@ -425,7 +425,7 @@ install_dependencies() { swiftenv rehash echo "Finished restoring cached Swift version" fi - + # swiftenv expects the following environment variables to refer to # swiftenv internals if PLATFORM= URL= VERSION= swiftenv install -s $SWIFT_VERSION @@ -450,6 +450,12 @@ install_dependencies() { fi fi + # Homebrew from Brewfile + if [ -f Brewfile ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ] + then + brew bundle + fi + # NPM Dependencies : ${YARN_VERSION="$defaultYarnVersion"} @@ -665,12 +671,6 @@ install_dependencies() { rm -rf $GOPATH/src/$GO_IMPORT_PATH ln -s /opt/buildhome/repo ${GOPATH}/src/$GO_IMPORT_PATH fi - - # Homebrew from Brewfile - if [ -f Brewfile ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ] - then - brew bundle - fi } # From 705b20954c2679b1ec164704b1eae7070af480a6 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Mon, 4 May 2020 23:35:14 +0200 Subject: [PATCH 3/4] Log when installing Homebrew dependencies --- run-build-functions.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/run-build-functions.sh b/run-build-functions.sh index 6c4d7eb0..ab106d6b 100755 --- a/run-build-functions.sh +++ b/run-build-functions.sh @@ -453,6 +453,7 @@ install_dependencies() { # Homebrew from Brewfile if [ -f Brewfile ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ] then + echo "Installing Homebrew dependencies from ${HOMEBREW_BUNDLE_FILE:-Brewfile}" brew bundle fi From bc39def7a8887a521406d1a2c66b237970cdd6ff Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Thu, 7 May 2020 01:29:40 +0200 Subject: [PATCH 4/4] Warn about status of Homebrew support --- included_software.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/included_software.md b/included_software.md index c67aa72c..84426410 100644 --- a/included_software.md +++ b/included_software.md @@ -73,7 +73,9 @@ The specific patch versions included will depend on when the image was last buil * [WASMER](https://github.com/wasmerio/wasmer) * [WAPM](https://github.com/wasmerio/wapm-cli) -* [Homebrew](https://brew.sh/) +* [Homebrew](https://brew.sh/) - **EARLY ALPHA** + - this is not production ready + - it might be removed or changed significantly - Any linux formula is supported: https://formulae.brew.sh/formula-linux/ - Formulae from a `Brewfile` are installed automatically via [`brew bundle`](https://github.com/Homebrew/homebrew-bundle#readme) - `HOMEBREW_BUNDLE_FILE` is respected