Добавить memory policy для frontend build в builder и задокументировать override
This commit is contained in:
@@ -176,9 +176,32 @@ If frozen install fails, update dependencies intentionally in source control and
|
|||||||
- `PACKAGE_VERSION=0.1.6`
|
- `PACKAGE_VERSION=0.1.6`
|
||||||
- `BUILD_ID=prod-$(date -u +%Y%m%dT%H%M%SZ)`
|
- `BUILD_ID=prod-$(date -u +%Y%m%dT%H%M%SZ)`
|
||||||
- `BUN_FLAVOR=auto|x64|x64-baseline`
|
- `BUN_FLAVOR=auto|x64|x64-baseline`
|
||||||
|
- `FRONTEND_NODE_OLD_SPACE_SIZE=2048` (default memory limit for frontend build step)
|
||||||
- `TOOLCHAIN_DIR=/custom/path/.toolchain`
|
- `TOOLCHAIN_DIR=/custom/path/.toolchain`
|
||||||
- `VERIFY_TOOLCHAIN_CHECKSUMS=true`
|
- `VERIFY_TOOLCHAIN_CHECKSUMS=true`
|
||||||
|
|
||||||
|
## Frontend memory policy
|
||||||
|
|
||||||
|
Builder applies a safe default Node.js heap limit for frontend build inside [`bundle_ui()`](lib/package.sh):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--max-old-space-size=2048
|
||||||
|
```
|
||||||
|
|
||||||
|
Override options:
|
||||||
|
|
||||||
|
- adjust default value for this policy:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
FRONTEND_NODE_OLD_SPACE_SIZE=3072 ./tools/build/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
- or provide full custom Node options (if `--max-old-space-size` is already set there, builder will not append another one):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NODE_OPTIONS="--max-old-space-size=3072" ./tools/build/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Диагностика
|
## Диагностика
|
||||||
|
|
||||||
Проверить AVX2:
|
Проверить AVX2:
|
||||||
|
|||||||
@@ -47,6 +47,17 @@ bundle_ui() {
|
|||||||
|
|
||||||
(
|
(
|
||||||
cd "$ui_src/frontend"
|
cd "$ui_src/frontend"
|
||||||
|
|
||||||
|
local frontend_node_old_space_size="${FRONTEND_NODE_OLD_SPACE_SIZE:-2048}"
|
||||||
|
local frontend_node_options="${NODE_OPTIONS:-}"
|
||||||
|
|
||||||
|
if [[ "$frontend_node_options" != *"--max-old-space-size="* ]]; then
|
||||||
|
frontend_node_options="${frontend_node_options:+$frontend_node_options }--max-old-space-size=${frontend_node_old_space_size}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export NODE_OPTIONS="$frontend_node_options"
|
||||||
|
log_info "Frontend Node.js options: $NODE_OPTIONS"
|
||||||
|
|
||||||
"$PNPM_BIN" install --frozen-lockfile
|
"$PNPM_BIN" install --frozen-lockfile
|
||||||
"$PNPM_BIN" run build:prod
|
"$PNPM_BIN" run build:prod
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user