Merge pull request #105 from murgatroid99/alpine_build

Add Alpine build script and Dockerfile, improve existing build scripts
This commit is contained in:
Michael Lumish 2017-11-30 09:30:37 -08:00 committed by GitHub
commit 36eb23e9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 29 deletions

View File

@ -0,0 +1,2 @@
FROM node:8-alpine
RUN apk add --no-cache python curl bash build-base

View File

@ -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

View File

@ -12,6 +12,8 @@
@rem See the License for the specific language governing permissions and
@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 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,21 +26,23 @@ call npm update || goto :error
mkdir -p %ARTIFACTS_OUT%
for %%v in (%node_versions%) do (
call .\node_modules\.bin\node-pre-gyp.cmd configure build --target=%%v --target_arch=%1
for %%a in (%arch_list%) do (
for %%v in (%node_versions%) do (
call .\node_modules\.bin\node-pre-gyp.cmd configure build --target=%%v --target_arch=%%a
@rem Try again after removing openssl headers
rmdir "%USERPROFILE%\.node-gyp\%%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
@rem Try again after removing openssl headers
rmdir "%USERPROFILE%\.node-gyp\%%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=%%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 (
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
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=%%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%

View File

@ -13,12 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
NODE_TARGET_ARCH=$1
NODE_TARGET_OS=$2
source ~/.nvm/nvm.sh
NODE_ALPINE_BUILD=false
nvm use 8
set -ex
while true ; do
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
@ -30,24 +42,25 @@ mkdir -p "${ARTIFACTS_OUT}"
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 )
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 version in ${node_versions[@]}
for arch in ${arch_list[@]}
do
./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true
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
for version in ${node_versions[@]}
do
./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}"/
fi
done
for version in ${electron_versions[@]}
do
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}"/
done
done
for version in ${electron_versions[@]}
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
cp -r build/stage/* "${ARTIFACTS_OUT}"/
done
rm -rf build || true

View File

@ -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