mirror of https://github.com/grpc/grpc-node.git
Merge pull request #105 from murgatroid99/alpine_build
Add Alpine build script and Dockerfile, improve existing build scripts
This commit is contained in:
commit
36eb23e9e7
|
@ -0,0 +1,2 @@
|
||||||
|
FROM node:8-alpine
|
||||||
|
RUN apk add --no-cache python curl bash build-base
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2017 gRPC authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
source ~/.nvm/nvm.sh
|
||||||
|
|
||||||
|
nvm install 8
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
tool_dir=$(pwd)
|
||||||
|
cd $tool_dir/../../..
|
||||||
|
base_dir=$(pwd)
|
||||||
|
|
||||||
|
export ARTIFACTS_OUT=$base_dir/artifacts
|
||||||
|
|
||||||
|
rm -rf build || true
|
||||||
|
|
||||||
|
mkdir -p "${ARTIFACTS_OUT}"
|
||||||
|
|
||||||
|
docker build -t alpine_node_artifact $base_dir/tools/docker/alpine_artifact
|
||||||
|
|
||||||
|
$tool_dir/build_artifact_node.sh
|
||||||
|
|
||||||
|
$tool_dir/build_artifact_node_arm.sh
|
||||||
|
|
||||||
|
docker run -e ARTIFACTS_OUT=/var/grpc/artifacts -v $base_dir:/var/grpc alpine_node_artifact bash -c /var/grpc/tools/run_tests/artifacts/build_artifact_node.sh --with-alpine
|
|
@ -12,6 +12,8 @@
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
|
|
||||||
|
set arch_list=ia32 x64
|
||||||
|
|
||||||
set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0
|
set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0
|
||||||
|
|
||||||
set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0
|
set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0
|
||||||
|
@ -24,22 +26,24 @@ call npm update || goto :error
|
||||||
|
|
||||||
mkdir -p %ARTIFACTS_OUT%
|
mkdir -p %ARTIFACTS_OUT%
|
||||||
|
|
||||||
|
for %%a in (%arch_list%) do (
|
||||||
for %%v in (%node_versions%) do (
|
for %%v in (%node_versions%) do (
|
||||||
call .\node_modules\.bin\node-pre-gyp.cmd configure build --target=%%v --target_arch=%1
|
call .\node_modules\.bin\node-pre-gyp.cmd configure build --target=%%v --target_arch=%%a
|
||||||
|
|
||||||
@rem Try again after removing openssl headers
|
@rem Try again after removing openssl headers
|
||||||
rmdir "%USERPROFILE%\.node-gyp\%%v\include\node\openssl" /S /Q
|
rmdir "%USERPROFILE%\.node-gyp\%%v\include\node\openssl" /S /Q
|
||||||
rmdir "%USERPROFILE%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q
|
rmdir "%USERPROFILE%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q
|
||||||
call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%1 || goto :error
|
call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%%a || goto :error
|
||||||
|
|
||||||
xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error
|
xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error
|
||||||
)
|
)
|
||||||
|
|
||||||
for %%v in (%electron_versions%) do (
|
for %%v in (%electron_versions%) do (
|
||||||
cmd /V /C "set "HOME=%USERPROFILE%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error
|
cmd /V /C "set "HOME=%USERPROFILE%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%%a --disturl=https://atom.io/download/electron" || goto :error
|
||||||
|
|
||||||
xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error
|
xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error
|
||||||
)
|
)
|
||||||
|
)
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
|
@ -13,12 +13,24 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
NODE_TARGET_ARCH=$1
|
NODE_ALPINE_BUILD=false
|
||||||
NODE_TARGET_OS=$2
|
|
||||||
source ~/.nvm/nvm.sh
|
|
||||||
|
|
||||||
nvm use 8
|
while true ; do
|
||||||
set -ex
|
case $1 in
|
||||||
|
--with-alpine)
|
||||||
|
NODE_ALPINE_BUILD=true
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown parameter: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift || break
|
||||||
|
done
|
||||||
|
|
||||||
|
NODE_ALPINE_BUILD=$1
|
||||||
|
|
||||||
umask 022
|
umask 022
|
||||||
|
|
||||||
|
@ -30,24 +42,25 @@ mkdir -p "${ARTIFACTS_OUT}"
|
||||||
|
|
||||||
npm update
|
npm update
|
||||||
|
|
||||||
|
arch_list=( ia32 x64 )
|
||||||
|
|
||||||
node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 )
|
node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 )
|
||||||
|
|
||||||
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 )
|
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 )
|
||||||
|
|
||||||
|
for arch in ${arch_list[@]}
|
||||||
|
do
|
||||||
for version in ${node_versions[@]}
|
for version in ${node_versions[@]}
|
||||||
do
|
do
|
||||||
./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true
|
./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$arch --grpc_alpine=$NODE_ALPINE_BUILD
|
||||||
cp -r build/stage/* "${ARTIFACTS_OUT}"/
|
cp -r build/stage/* "${ARTIFACTS_OUT}"/
|
||||||
if [ "$NODE_TARGET_ARCH" == 'x64' ] && [ "$NODE_TARGET_OS" == 'linux' ]
|
|
||||||
then
|
|
||||||
# Cross compile for ARM on x64
|
|
||||||
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-g++ ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=arm
|
|
||||||
cp -r build/stage/* "${ARTIFACTS_OUT}"/
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for version in ${electron_versions[@]}
|
for version in ${electron_versions[@]}
|
||||||
do
|
do
|
||||||
HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron
|
HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$arch --disturl=https://atom.io/download/electron
|
||||||
cp -r build/stage/* "${ARTIFACTS_OUT}"/
|
cp -r build/stage/* "${ARTIFACTS_OUT}"/
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -rf build || true
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2017 gRPC authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
source ~/.nvm/nvm.sh
|
||||||
|
|
||||||
|
nvm use 8
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd $(dirname $0)/../../..
|
||||||
|
|
||||||
|
rm -rf build || true
|
||||||
|
|
||||||
|
mkdir -p "${ARTIFACTS_OUT}"
|
||||||
|
|
||||||
|
npm update
|
||||||
|
|
||||||
|
node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 )
|
||||||
|
|
||||||
|
for version in ${node_versions[@]}
|
||||||
|
do
|
||||||
|
# Cross compile for ARM on x64
|
||||||
|
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-g++ ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=arm
|
||||||
|
cp -r build/stage/* "${ARTIFACTS_OUT}"/
|
||||||
|
done
|
Loading…
Reference in New Issue