fix(docker): raise builder Node heap limit and make tsc typecheck opt-in during image build
This commit is contained in:
parent
2cbcde6d46
commit
65d88f0a1e
2 changed files with 9 additions and 1 deletions
|
|
@ -12,7 +12,10 @@ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
||||||
|
|
||||||
COPY tsconfig.json ./
|
COPY tsconfig.json ./
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
RUN npm run build && npm prune --omit=dev
|
ARG RUN_TYPECHECK=false
|
||||||
|
ARG BUILD_NODE_MAX_OLD_SPACE=768
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=${BUILD_NODE_MAX_OLD_SPACE}"
|
||||||
|
RUN if [ "$RUN_TYPECHECK" = "true" ]; then npm run build; else npm run build:client && npm run build:server; fi && npm prune --omit=dev
|
||||||
|
|
||||||
FROM node:22-bookworm-slim AS runtime
|
FROM node:22-bookworm-slim AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ Options:
|
||||||
--mode <lan|cloudflare> Explicitly select deployment mode
|
--mode <lan|cloudflare> Explicitly select deployment mode
|
||||||
--no-cache Pass --no-cache to docker compose build
|
--no-cache Pass --no-cache to docker compose build
|
||||||
--pull Pass --pull to docker compose build
|
--pull Pass --pull to docker compose build
|
||||||
|
--typecheck Run `tsc --noEmit` inside Docker builder (uses more RAM)
|
||||||
--dry-run Print the compose command without executing it
|
--dry-run Print the compose command without executing it
|
||||||
-h, --help Show this help message
|
-h, --help Show this help message
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -47,6 +48,10 @@ while [[ $# -gt 0 ]]; do
|
||||||
BUILD_FLAGS+=("$1")
|
BUILD_FLAGS+=("$1")
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--typecheck)
|
||||||
|
BUILD_FLAGS+=(--build-arg RUN_TYPECHECK=true)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--dry-run)
|
--dry-run)
|
||||||
DRY_RUN=1
|
DRY_RUN=1
|
||||||
shift
|
shift
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue