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

Commit 4b48fbd

Browse files
authored
Merge pull request #474 from netlify/feat/homebrew
Support installing tools via Homebrew (take 2)
2 parents ff8f5a3 + 962be09 commit 4b48fbd

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

Dockerfile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
4848
emacs25-nox \
4949
esl-erlang \
5050
expect \
51+
file \
5152
fontconfig \
5253
fontconfig-config \
5354
g++ \
@@ -443,13 +444,6 @@ ENV GIMME_GO_VERSION "1.14.4"
443444
ENV GIMME_ENV_PREFIX "/opt/buildhome/.gimme/env"
444445
RUN gimme | bash
445446

446-
################################################################################
447-
#
448-
# Wasmer
449-
#
450-
################################################################################
451-
RUN curl https://get.wasmer.io -sSfL | sh
452-
453447
################################################################################
454448
#
455449
# Dotnet Core
@@ -465,7 +459,6 @@ ENV DOTNET_ROOT "/opt/buildhome/.dotnet"
465459
#populate local package cache
466460
RUN dotnet new
467461

468-
469462
################################################################################
470463
#
471464
# Swift
@@ -479,6 +472,20 @@ ENV PATH "$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
479472
RUN swiftenv install ${NETLIFY_BUILD_SWIFT_VERSION}
480473
RUN swift --version
481474

475+
################################################################################
476+
#
477+
# Homebrew
478+
#
479+
################################################################################
480+
USER buildbot
481+
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
482+
ENV PATH "/opt/buildhome/.linuxbrew/bin:$PATH"
483+
ENV HOMEBREW_PREFIX "/opt/buildhome/.linuxbrew"
484+
ENV HOMEBREW_CELLAR "/opt/buildhome/.linuxbrew/Cellar"
485+
ENV HOMEBREW_REPOSITORY "/opt/buildhome/.linuxbrew/Homebrew"
486+
ENV HOMEBREW_CACHE "/opt/buildhome/.homebrew-cache"
487+
RUN brew tap homebrew/bundle
488+
482489
WORKDIR /
483490

484491
# Cleanup

included_software.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,10 @@ The specific patch versions included will depend on when the image was last buil
7070
* [GNU Make](https://www.gnu.org/software/make/) - 3.81
7171
* OptiPNG - 0.6.4
7272
* [Doxygen](http://www.doxygen.org) - 1.8.6
73-
* [WASMER](https://github.com/wasmerio/wasmer)
74-
* [WAPM](https://github.com/wasmerio/wapm-cli)
73+
74+
* [Homebrew](https://brew.sh/) - **EARLY ALPHA**
75+
- this is not production ready
76+
- it might be removed or changed significantly
77+
- Any linux formula is supported: https://formulae.brew.sh/formula-linux/
78+
- Formulae from a `Brewfile.netlify` are installed automatically via [`brew bundle`](https://github.com/Homebrew/homebrew-bundle#readme)
79+
- `HOMEBREW_BUNDLE_FILE` is respected

run-build-functions.sh

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ mkdir -p $NETLIFY_CACHE_DIR/node_modules
4040
mkdir -p $NETLIFY_CACHE_DIR/.bundle
4141
mkdir -p $NETLIFY_CACHE_DIR/bower_components
4242
mkdir -p $NETLIFY_CACHE_DIR/.venv
43-
mkdir -p $NETLIFY_CACHE_DIR/wapm_packages
4443
mkdir -p $NETLIFY_CACHE_DIR/.build
4544
mkdir -p $NETLIFY_CACHE_DIR/.netlify/plugins
4645

@@ -54,7 +53,7 @@ mkdir -p $NETLIFY_CACHE_DIR/.boot
5453
mkdir -p $NETLIFY_CACHE_DIR/.composer
5554
mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gopath
5655
mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gocache
57-
mkdir -p $NETLIFY_CACHE_DIR/.wasmer/cache
56+
mkdir -p $NETLIFY_CACHE_DIR/.homebrew-cache
5857

5958
: ${YARN_FLAGS=""}
6059
: ${NPM_FLAGS=""}
@@ -452,6 +451,14 @@ install_dependencies() {
452451
fi
453452
fi
454453

454+
# Homebrew from Brewfile
455+
if [ -f Brewfile.netlify ] || [ ! -z "$HOMEBREW_BUNDLE_FILE" ]
456+
then
457+
: ${HOMEBREW_BUNDLE_FILE:="Brewfile.netlify"}
458+
echo "Installing Homebrew dependencies from ${HOMEBREW_BUNDLE_FILE}"
459+
brew bundle
460+
fi
461+
455462
# NPM Dependencies
456463
: ${YARN_VERSION="$defaultYarnVersion"}
457464
: ${CYPRESS_CACHE_FOLDER="./node_modules/.cache/CypressBinary"}
@@ -629,22 +636,6 @@ install_dependencies() {
629636
fi
630637
fi
631638

632-
# WAPM version
633-
source $HOME/.wasmer/wasmer.sh
634-
if [ -f wapm.toml ] || [ -f wapm.lock ]
635-
then
636-
restore_home_cache ".wasmer/cache" "wasmer cache"
637-
restore_cwd_cache "wapm_packages" "wapm packages"
638-
wapm install
639-
if [ $? -eq 0 ]
640-
then
641-
echo "Wapm packages installed"
642-
else
643-
echo "Error during Wapm install"
644-
exit 1
645-
fi
646-
fi
647-
648639
# Setup project GOPATH
649640
if [ -n "$GO_IMPORT_PATH" ]
650641
then
@@ -663,7 +654,6 @@ cache_artifacts() {
663654
cache_cwd_directory "bower_components" "bower components"
664655
cache_cwd_directory "node_modules" "node modules"
665656
cache_cwd_directory ".venv" "python virtualenv"
666-
cache_cwd_directory "wapm_packages" "wapm packages"
667657
cache_cwd_directory ".build" "swift build"
668658
cache_cwd_directory ".netlify/plugins" "build plugins"
669659

@@ -674,7 +664,7 @@ cache_artifacts() {
674664
cache_home_directory ".m2" "maven dependencies"
675665
cache_home_directory ".boot" "boot dependencies"
676666
cache_home_directory ".composer" "composer dependencies"
677-
cache_home_directory ".wasmer/cache", "wasmer cache"
667+
cache_home_directory ".homebrew-cache", "homebrew cache"
678668

679669
# Don't follow the Go import path or we'll store
680670
# the origin repo twice.

0 commit comments

Comments
 (0)