-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove node-pre-gyp, use prebuildify
Added Dockerfiles for cross-platform build.
- Loading branch information
Showing
11 changed files
with
281 additions
and
769 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.git/ | ||
.vscode/ | ||
Dockerfile* | ||
prebuilds/ | ||
node_modules/ | ||
build*/ |
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,6 +1,8 @@ | ||
.lock* | ||
build* | ||
build*/ | ||
*.node | ||
*.sw[a-z] | ||
node_modules | ||
.idea/ | ||
prebuilds/ | ||
*.tgz |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.lock* | ||
build*/ | ||
*.sw[a-z] |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/echo docker build . -f | ||
# -*- coding: utf-8 -*- | ||
# SPDX-License-Identifier: ISC | ||
# Copyright 2021 VoltServer Inc | ||
#{ | ||
# ISC License | ||
# Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") | ||
# Copyright (c) 1995-2003 by Internet Software Consortium | ||
# Permission to use, copy, modify, and /or distribute this software | ||
# for any purpose with or without fee is hereby granted, | ||
# provided that the above copyright notice | ||
# and this permission notice appear in all copies. | ||
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES | ||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | ||
# OF MERCHANTABILITY AND FITNESS. | ||
# IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | ||
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
# WHETHER IN AN ACTION OF CONTRACT, | ||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
# ARISING OUT OF OR IN CONNECTION WITH THE USE | ||
# OR PERFORMANCE OF THIS SOFTWARE. | ||
#} | ||
# | ||
# Usage: | ||
# | ||
# docker build -t voltserver/bcryptjs-linux-x64-builder . | ||
# docker create --name donut voltserver/bcryptjs-linux-x64-builder | ||
# # Then copy the artifact to your host: | ||
# docker cp donut:/usr/local/opt/bcrypt-js/prebuilds . | ||
|
||
FROM node:14-bullseye | ||
|
||
ENV project bcrypt-js | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV LANG ${LC_ALL} | ||
|
||
RUN echo "#log: ${project}: Setup system" \ | ||
&& set -x \ | ||
&& apt-get update -y \ | ||
&& apt-get install -y \ | ||
build-essential \ | ||
python3 \ | ||
&& apt-get clean \ | ||
&& update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20 \ | ||
&& npm i -g prebuildify node-gyp \ | ||
&& sync | ||
|
||
ADD . /usr/local/opt/${project} | ||
WORKDIR /usr/local/opt/${project} | ||
|
||
RUN echo "#log: ${project}: Running build" \ | ||
&& set -x \ | ||
&& npm i \ | ||
&& npm run build | ||
|
||
ARG RUN_TESTS=true | ||
|
||
RUN if "${RUN_TESTS}"; then \ | ||
echo "#log ${project}: Running tests" \ | ||
&& npm test; \ | ||
else \ | ||
echo "#log ${project}: Tests were skipped!"; \ | ||
fi | ||
|
||
CMD /bin/bash -l |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Usage: | ||
# | ||
# docker build -t bcryptjs-linux-arm-builder -f Dockerfile-arm . | ||
# docker create --name donut bcryptjs-linux-arm-builder | ||
# # Then copy the artifact to your host: | ||
# docker cp donut:/usr/local/opt/bcrypt-js/prebuilds . | ||
|
||
FROM arm32v7/node:14-bullseye | ||
|
||
ENV project bcrypt-js | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV LANG ${LC_ALL} | ||
|
||
RUN echo "#log: ${project}: Setup system" \ | ||
&& set -x \ | ||
&& apt-get update -y \ | ||
&& apt-get install -y \ | ||
build-essential \ | ||
python3 \ | ||
&& apt-get clean \ | ||
&& update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20 \ | ||
&& npm i -g prebuildify node-gyp \ | ||
&& sync | ||
|
||
ADD . /usr/local/opt/${project} | ||
WORKDIR /usr/local/opt/${project} | ||
|
||
RUN echo "#log: ${project}: Running build" \ | ||
&& set -x \ | ||
&& npm i \ | ||
&& npm run build | ||
|
||
ARG RUN_TESTS=true | ||
|
||
RUN if "${RUN_TESTS}"; then \ | ||
echo "#log ${project}: Running tests" \ | ||
&& npm test; \ | ||
else \ | ||
echo "#log ${project}: Tests were skipped!"; \ | ||
fi | ||
|
||
CMD /bin/bash -l |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Usage: | ||
# | ||
# docker build -t bcryptjs-linux-arm64-builder -f Dockerfile-arm64 . | ||
# docker create --name donut-arm64 bcryptjs-linux-arm64-builder | ||
# # Then copy the artifact to your host: | ||
# docker cp donut-arm64:/usr/local/opt/bcrypt-js/prebuilds . | ||
|
||
FROM arm64v8/node:14-bullseye | ||
|
||
ENV project bcrypt-js | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV LANG ${LC_ALL} | ||
|
||
RUN echo "#log: ${project}: Setup system" \ | ||
&& set -x \ | ||
&& apt-get update -y \ | ||
&& apt-get install -y \ | ||
build-essential \ | ||
python3 \ | ||
&& apt-get clean \ | ||
&& update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20 \ | ||
&& npm i -g prebuildify node-gyp \ | ||
&& sync | ||
|
||
ADD . /usr/local/opt/${project} | ||
WORKDIR /usr/local/opt/${project} | ||
|
||
RUN echo "#log: ${project}: Running build" \ | ||
&& set -x \ | ||
&& npm i \ | ||
&& npm run build | ||
|
||
ARG RUN_TESTS=true | ||
|
||
RUN if "${RUN_TESTS}"; then \ | ||
echo "#log ${project}: Running tests" \ | ||
&& npm test; \ | ||
else \ | ||
echo "#log ${project}: Tests were skipped!"; \ | ||
fi | ||
|
||
CMD /bin/bash -l | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash -ue | ||
|
||
CLEAN=${CLEAN:-""} | ||
RUN_TESTS=${RUN_TESTS:-false} # tests presently fail on arm :( | ||
|
||
if [ -n "$CLEAN" ]; then | ||
rm -rf build build-tmp* | ||
rm -rf prebuilds | ||
fi | ||
|
||
npm i | ||
npm i -g prebuildify node-gyp | ||
npm run build | ||
|
||
# build for linux/x64: | ||
if [ ! -d prebuilds/linux-x64 ]; then | ||
docker build -t voltserver/bcryptjs-linux-x64-builder . | ||
CONTAINER=$(docker create voltserver/bcryptjs-linux-x64-builder) | ||
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 voltserver/bcryptjs-linux-arm-builder -f Dockerfile-arm --build-arg RUN_TESTS="$RUN_TESTS" . | ||
CONTAINER=$(docker create --platform linux/arm/v7 voltserver/bcryptjs-linux-arm-builder) | ||
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 voltserver/bcryptjs-linux-arm64-builder -f Dockerfile-arm64 --build-arg RUN_TESTS="$RUN_TESTS" . | ||
CONTAINER=$(docker create --platform linux/arm64/v8 voltserver/bcryptjs-linux-arm64-builder) | ||
docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" . | ||
docker rm "$CONTAINER" | ||
fi | ||
|
||
ls -lF prebuilds/ |
Oops, something went wrong.