This repository was archived by the owner on Aug 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM ubuntu:bionic
2+
3+ # Install tools
4+ RUN apt-get update
5+ RUN apt-get install -y build-essential python ninja-build vim git sudo
6+
7+ # Expose ports used by net tests
8+ ENV NODE_COMMON_PORT=12346
9+ EXPOSE 12346
10+ # debug port used by v8 debugger
11+ EXPOSE 5858
12+ # debug port used by v8 insepctor
13+ EXPOSE 9229
14+
15+ # Set up user node-dev: the tests fail when run by the root
16+ RUN adduser --disabled-password --gecos '' node-dev
17+ RUN adduser node-dev sudo
18+ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
19+ USER node-dev
20+ WORKDIR /home/node-dev
21+ ENV HOME /home/node-dev
22+
23+ # Clone the code and build
24+ RUN git clone --depth=1 https://github.com/nodejs/node.git
25+ WORKDIR /home/node-dev/node
26+ RUN python2 ./configure --ninja
27+ ENV BUILD_WITH ninja
28+ RUN make -j2 test
Original file line number Diff line number Diff line change 1+ # Node.js Code + Learn @ COSCon 2019
2+
3+ - [ 事前准备 (praparation)] ( ./preparation.md )
4+ - [ Dockerfile] ( ./Dockerfile )
5+ - [ Slides] ( https://docs.google.com/presentation/d/1NluODLOelMFyui10jSLY8T4M0F444LaG7Ir5u_tfOGM/edit?usp=sharing )
Original file line number Diff line number Diff line change 1+ # 事前准备
2+
3+ ## 安装环境
4+
5+ ### MacOS
6+
7+ 1 . 从 App Store 安装 Xcode
8+ 2 . 从命令行运行
9+
10+ ```
11+ xcode-select --install
12+ ```
13+ 3 . 推荐安装 ninja。如使用 homebrew:
14+
15+ ```
16+ brew install ninja
17+ ```
18+
19+ ### Ubuntu
20+
21+ ```
22+ apt-get update
23+ apt-get install -y build-essential python ninja-build make g++
24+ ```
25+
26+ ### 其他环境
27+
28+ UNIX: https://github.com/nodejs/node/blob/master/BUILDING.md#unix-prerequisites
29+ Windows: https://github.com/nodejs/node/blob/master/BUILDING.md#prerequisites
30+
31+ ## 构建与测试
32+
33+ 全部环境:推荐先 clone Node.js core 的代码。因为体积较大,建议用 ` --depth=1 ` :
34+
35+ ```
36+ git clone --depth=1 https://github.com/nodejs/node.git
37+ ```
38+
39+ 推荐在参加前先编译(需耗时半个小时到一个小时)和运行一遍测试(会从 npm 下载一些渲染 API 文档需要的包)。MacOS 和 Linux:
40+
41+ ```
42+ cd node
43+
44+ # 如果有安装 ninja
45+ python2 ./configure --ninja
46+ BUILD_WITH=ninja make -j2 test
47+
48+ # 如果没有安装 ninja
49+ python2 ./configure
50+ make -j2 test
51+ ```
52+
53+ 其中 -j2 的 2 可以替换成机器上的 CPU 逻辑核心数。
You can’t perform that action at this time.
0 commit comments