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 #411

Merged
merged 4 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion 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 @@ -468,7 +469,6 @@ ENV DOTNET_ROOT "/opt/buildhome/.dotnet"
#populate local package cache
RUN dotnet new


################################################################################
#
# Swift
Expand All @@ -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)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any concern that we aren't pulling from a static/stable tag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point. let's do that as part of a general release

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)

* [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
11 changes: 10 additions & 1 deletion run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""}
Expand Down Expand Up @@ -424,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
Expand All @@ -449,6 +450,13 @@ install_dependencies() {
fi
fi

# Homebrew from Brewfile
if [ -f Brewfile ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, -n should also be equivalent to ! -z

then
echo "Installing Homebrew dependencies from ${HOMEBREW_BUNDLE_FILE:-Brewfile}"
brew bundle
fi

# NPM Dependencies
: ${YARN_VERSION="$defaultYarnVersion"}

Expand Down Expand Up @@ -686,6 +694,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.
Expand Down