Skip to content

Commit

Permalink
add compact build scripts and accelerate node-pre-gyp
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonation committed Sep 28, 2020
1 parent 19a96b3 commit fb95c8e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
arch/
nwjs/
node/
package.nw/
Expand Down
61 changes: 61 additions & 0 deletions compact/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM debian:stretch
LABEL maintainer="minun ([email protected])"

ENV LANG=C.UTF-8

# update repo sources
RUN set -ex; \
cp /etc/apt/sources.list /etc/apt/sources.list.bak; \
echo "deb http://mirrors.aliyun.com/debian/ stretch main" > /etc/apt/sources.list; \
echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main" >> /etc/apt/sources.list; \
rm -rf /var/cache/apt/archives/lock \
apt-get clean; \
apt-get update --fix-missing;

RUN DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
apt-utils \
build-essential \
ca-certificates \
git \
libx11-dev \
libxkbfile-dev \
pkg-config \
python \
p7zip-full

ADD runtime-mewjs.tar.gz /opt/mewjs
COPY node-v12.6.0-linux-x64.tar.gz /opt/wechat/cache/node-v12.6.0-linux-x64.tar.gz
COPY nwjs-sdk-v0.39.3-linux-x64.tar.gz /opt/wechat/cache/nwjs-sdk-v0.39.3-linux-x64.tar.gz
COPY wechat_devtools_1.03.2009140_x64.exe /opt/wechat/cache/wechat_devtools_1.03.2009140_x64.exe
COPY build /opt/wechat/cache/build

RUN chmod +x /opt/mewjs/bin/hako \
/opt/mewjs/bin/mew \
/opt/mewjs/bin/chan \
/opt/mewjs/bin/mew_* \
/opt/mewjs/bin/npm \
/opt/mewjs/bin/npx

RUN set -ex; \
useradd -m builder -s /bin/bash; \
mkdir -p /opt/local/proj; \
cd /opt/local/proj; \
git clone https://github.com/dragonation/wechat-devtools.git; \
mkdir -p /opt/local/proj/wechat-devtools/cache; \
cd wechat-devtools; \
cp -fr /opt/wechat/cache/* cache/; \
cp -f /opt/wechat/cache/build build; \
chmod -R 777 .

ENV PATH=/opt/mewjs/bin:/usr/local/bin:/usr/bin:/bin

WORKDIR /opt/local/proj/wechat-devtools

# docker build -t wechat-devtools-compact-builder .
# docker run -ti --rm -v `pwd`:/opt/wechat/output wechat-devtools-compact-builder /bin/bash --login -i

# su builder
# export PATH=/opt/mewjs/bin:$PATH
# ./build
# cp wechat-devtools-compact.tar.gz /opt/wechat/output/wechat-devtools-1.03.2009140-compact.tar.gz
7 changes: 7 additions & 0 deletions compact/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

./tools/setup-wechat-devtools &&

tar cvzf wechat-devtools-compact.tar.gz bin conf license.md node nwjs package.nw patch readme.md res tools wine


3 changes: 2 additions & 1 deletion tools/rebuild-node-modules
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ rm -fr "${package_dir}/node_modules_tmp/node_modules/spdlog-node"
trash \
vscode-oniguruma \
vscode-ripgrep \
--registry=https://registry.npm.taobao.org) # reinstall modules
--registry=https://registry.npm.taobao.org \
--nodegit_binary_host_mirror=https://npm.taobao.org/mirrors/nodegit/v0.27.0/) # reinstall modules

(cp -fr "${package_dir}/node_modules_tmp/node_modules/node-pty" "${package_dir}/node_modules_tmp/node_modules/node-pty-node")
(cp -fr "${package_dir}/node_modules_tmp/node_modules/oniguruma" "${package_dir}/node_modules_tmp/node_modules/oniguruma-node")
Expand Down

0 comments on commit fb95c8e

Please sign in to comment.