-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use --platform to consolidate dockerfiles
- Loading branch information
Showing
8 changed files
with
57 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,37 @@ | ||
#!/bin/bash -ue | ||
|
||
CLEAN=${CLEAN:-""} | ||
RUN_TESTS=${RUN_TESTS:-true} | ||
RUN_TESTS=${RUN_TESTS:-true}l | ||
|
||
if [ -n "$CLEAN" ]; then | ||
rm -rf build build-tmp* | ||
rm -rf lib/binding | ||
rm -rf prebuilds | ||
fi | ||
|
||
npm i | ||
npm i -g prebuildify node-gyp | ||
npm run build | ||
npm ci | ||
#npm run build | ||
|
||
# build for linux/x64: | ||
if [ ! -d prebuilds/linux-x64 ]; then | ||
docker build -t bcryptjs-linux-x64-builder -f Dockerfile-x64 --build-arg RUN_TESTS="$RUN_TESTS" . | ||
CONTAINER=$(docker create bcryptjs-linux-x64-builder) | ||
for PLATFORM in linux/amd64 linux/arm64/v8 linux/arm/v7; do | ||
echo -- build for $PLATFORM -- | ||
BUILDER_NAME="bcryptjs-${PLATFORM//\/-}-builder" | ||
docker build -t "$BUILDER_NAME" \ | ||
--build-arg RUN_TESTS="$RUN_TESTS" \ | ||
--platform "$PLATFORM" . | ||
CONTAINER=$(docker create --platform "$PLATFORM" "$BUILDER_NAME") | ||
docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . | ||
docker rm "$CONTAINER" | ||
fi | ||
|
||
# build for linux/arm32: | ||
if [ ! -d prebuilds/linux-arm ]; then | ||
docker build -t bcryptjs-linux-arm-builder -f Dockerfile-arm --build-arg RUN_TESTS="$RUN_TESTS" . | ||
CONTAINER=$(docker create --platform linux/arm/v7 bcryptjs-linux-arm-builder) | ||
echo -- build for $PLATFORM Alpine -- | ||
BUILDER_NAME="bcryptjs-${PLATFORM//\/-}-alpine-builder" | ||
docker build -t "$BUILDER_NAME" -f Dockerfile-alpine \ | ||
--build-arg RUN_TESTS="$RUN_TESTS" \ | ||
--platform "$PLATFORM" . | ||
CONTAINER=$(docker create --platform "$PLATFORM" "$BUILDER_NAME") | ||
docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . | ||
docker rm "$CONTAINER" | ||
fi | ||
|
||
# build for linux/arm64: | ||
if [ ! -d prebuilds/linux-arm64 ]; then | ||
docker build -t bcryptjs-linux-arm64-builder -f Dockerfile-arm64 --build-arg RUN_TESTS="$RUN_TESTS" . | ||
CONTAINER=$(docker create --platform linux/arm64/v8 bcryptjs-linux-arm64-builder) | ||
docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . | ||
docker rm "$CONTAINER" | ||
fi | ||
done | ||
|
||
ls -lF prebuilds/ |