Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Support installing tools via Homebrew (take 2) #474

Merged
merged 10 commits into from
Nov 2, 2020
23 changes: 15 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
emacs25-nox \
esl-erlang \
expect \
file \
fontconfig \
fontconfig-config \
g++ \
Expand Down Expand Up @@ -443,13 +444,6 @@ ENV GIMME_GO_VERSION "1.14.4"
ENV GIMME_ENV_PREFIX "/opt/buildhome/.gimme/env"
RUN gimme | bash

################################################################################
#
# Wasmer
#
################################################################################
RUN curl https://get.wasmer.io -sSfL | sh

################################################################################
#
# Dotnet Core
Expand All @@ -465,7 +459,6 @@ ENV DOTNET_ROOT "/opt/buildhome/.dotnet"
#populate local package cache
RUN dotnet new


################################################################################
#
# Swift
Expand All @@ -479,6 +472,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
Expand Down
7 changes: 7 additions & 0 deletions included_software.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@ 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)
calavera marked this conversation as resolved.
Show resolved Hide resolved

* [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.netlify` are installed automatically via [`brew bundle`](https://github.com/Homebrew/homebrew-bundle#readme)
- `HOMEBREW_BUNDLE_FILE` is respected
30 changes: 10 additions & 20 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ mkdir -p $NETLIFY_CACHE_DIR/node_modules
mkdir -p $NETLIFY_CACHE_DIR/.bundle
mkdir -p $NETLIFY_CACHE_DIR/bower_components
mkdir -p $NETLIFY_CACHE_DIR/.venv
mkdir -p $NETLIFY_CACHE_DIR/wapm_packages
mkdir -p $NETLIFY_CACHE_DIR/.build
mkdir -p $NETLIFY_CACHE_DIR/.netlify/plugins

Expand All @@ -54,7 +53,7 @@ mkdir -p $NETLIFY_CACHE_DIR/.boot
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=""}
Expand Down Expand Up @@ -452,6 +451,14 @@ install_dependencies() {
fi
fi

# Homebrew from Brewfile
if [ -f Brewfile.netlify ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ]
then
: ${HOMEBREW_BUNDLE_FILE:="Brewfile.netlify"}
echo "Installing Homebrew dependencies from ${HOMEBREW_BUNDLE_FILE}"
brew bundle
fi

# NPM Dependencies
: ${YARN_VERSION="$defaultYarnVersion"}
: ${CYPRESS_CACHE_FOLDER="./node_modules/.cache/CypressBinary"}
Expand Down Expand Up @@ -629,22 +636,6 @@ install_dependencies() {
fi
fi

# WAPM version
source $HOME/.wasmer/wasmer.sh
if [ -f wapm.toml ] || [ -f wapm.lock ]
then
restore_home_cache ".wasmer/cache" "wasmer cache"
restore_cwd_cache "wapm_packages" "wapm packages"
wapm install
if [ $? -eq 0 ]
then
echo "Wapm packages installed"
else
echo "Error during Wapm install"
exit 1
fi
fi

# Setup project GOPATH
if [ -n "$GO_IMPORT_PATH" ]
then
Expand All @@ -663,7 +654,6 @@ cache_artifacts() {
cache_cwd_directory "bower_components" "bower components"
cache_cwd_directory "node_modules" "node modules"
cache_cwd_directory ".venv" "python virtualenv"
cache_cwd_directory "wapm_packages" "wapm packages"
cache_cwd_directory ".build" "swift build"
cache_cwd_directory ".netlify/plugins" "build plugins"

Expand All @@ -674,7 +664,7 @@ cache_artifacts() {
cache_home_directory ".m2" "maven dependencies"
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.
Expand Down