Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building only specific images & recipes for faster local dev #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ This places "v16.4.0" into `~/var/build_queue` which will be read on the next in

The same process can be used to queue `rc` or `test` builds.

## Local development

Build all platforms:

```sh
mkdir -p build
bin/prepare-images.sh && \
workdir=$PWD/build bin/build.sh v18.12.0
```

Or just (re)build, say, x86:

```sh
mkdir -p build
bin/prepare-images.sh fetch-source x86 && \
workdir=$PWD/build bin/build.sh v18.12.0 x86
```

## Team

unofficial-builds is maintained by:
Expand Down
31 changes: 19 additions & 12 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
workdir=${workdir:-"$__dirname"/../..}
image_tag_pfx=unofficial-build-recipe-
# all of our build recipes, new recipes just go into this list,
recipes=" \
headers \
x86 \
musl \
armv6l \
armv6l-pre16 \
x64-pointer-compression \
x64-usdt \
riscv64 \
"

ccachedir=$(realpath "${workdir}/.ccache")
stagingdir=$(realpath "${workdir}/staging")
distdir=$(realpath "${workdir}/download")
Expand All @@ -29,10 +19,27 @@ if [[ "X${1}" = "X" ]]; then
fi

fullversion="$1"
shift 1
. ${__dirname}/_decode_version.sh
decode "$fullversion"
# see _decode_version for all of the magic variables now set and available for use

if [[ $# -gt 0 ]]; then
recipes=( "$@" )
else
# all of our build recipes, new recipes just go into this list,
recipes=(
headers
x86
musl
armv6l
pre16
compression
usdt
Comment on lines +36 to +38
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pre16
compression
usdt
armv6l-pre16
x64-pointer-compression
x64-usdt

was this changed intentionally? perhaps they need to be quoted when they're listed as an array?

riscv64
)
fi

# Point RELEASE_URLBASE to the Unofficial Builds server
unofficial_release_urlbase="https://unofficial-builds.nodejs.org/download/${disttype}/"

Expand Down Expand Up @@ -65,7 +72,7 @@ docker run --rm \
> ${thislogdir}/fetch-source.log 2>&1

# Build all other recipes
for recipe in $recipes; do
for recipe in "${recipes[@]}" ; do
# each recipe has 3 variable components:
# - individiaul ~/.ccache directory
# - a ~/node.tar.xz file that fetch-source has downloaded
Expand Down
8 changes: 7 additions & 1 deletion bin/prepare-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
image_tag_pfx=unofficial-build-recipe-

for recipe in $(ls ${__dirname}/../recipes/); do
if [[ $# -gt 0 ]]; then
recipes=( "$@" )
else
recipes=( $(ls ${__dirname}/../recipes/) )
fi

for recipe in "${recipes[@]}" ; do
docker build ${__dirname}/../recipes/${recipe}/ -t ${image_tag_pfx}${recipe} --build-arg UID=1000 --build-arg GID=1000
done

Expand Down