From beea1961bfcc8ec87d2711ad5f001a2b8b7eecfe Mon Sep 17 00:00:00 2001 From: Alex Errant <109672176+AlexErrant@users.noreply.github.com> Date: Tue, 2 Jun 2026 21:50:37 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20container=20crash=20on=20startup:=20onnxr?= =?UTF-8?q?untime-node=20requires=20glibc=20(switch=20Alpine=20=E2=86=92?= =?UTF-8?q?=20Debian=20slim)=20(#97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docker fixes * fix(worker): default COMPUTE_PREWARM_MODELS to false and update docs, env, and compose Set COMPUTE_PREWARM_MODELS to false by default in runtime, docker-compose, and .env.example to avoid pre-downloading ONNX models during worker startup. Update Dockerfile and deployment documentation to reflect this change and clarify configuration for model prewarming. * fix(docker): downgrade pnpm version to 10.33.4 for compatibility --------- Co-authored-by: Richard R --- Dockerfile | 10 ++++++---- compute/worker/.env.example | 2 +- compute/worker/docker-compose.yml | 2 +- compute/worker/src/runtime.ts | 2 +- docs-site/docs/deploy/compute-worker.md | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index fb36d6e..1f77685 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,10 @@ RUN cp "$(command -v nats-server)" /tmp/nats-server # Stage 2: build the Next.js app -FROM node:lts-alpine AS app-builder +FROM node:lts-slim AS app-builder # Install pnpm globally -RUN npm install -g pnpm@11.1.2 +RUN npm install -g pnpm@10.33.4 # Create app directory WORKDIR /app @@ -44,12 +44,14 @@ RUN mkdir -p /app/THIRD_PARTY_LICENSES && \ # Stage 3: minimal runtime image -FROM node:lts-alpine AS runner +FROM node:lts-slim AS runner # Add runtime OS dependencies: # - libreoffice-writer: required for DOCX → PDF conversion # ffmpeg is provided by ffmpeg-static from node_modules. -RUN apk add --no-cache ca-certificates libreoffice-writer +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates libreoffice-writer && \ + rm -rf /var/lib/apt/lists/* # Install pnpm for runtime process commands. RUN npm install -g pnpm@10.33.4 diff --git a/compute/worker/.env.example b/compute/worker/.env.example index 15472fa..ebc0ffa 100644 --- a/compute/worker/.env.example +++ b/compute/worker/.env.example @@ -39,7 +39,7 @@ S3_ENDPOINT=http://host.docker.internal:8333 S3_FORCE_PATH_STYLE=true # Optional tuning -# COMPUTE_PREWARM_MODELS=true +# COMPUTE_PREWARM_MODELS=false # COMPUTE_JOB_CONCURRENCY=1 # COMPUTE_WHISPER_TIMEOUT_MS=30000 # COMPUTE_PDF_TIMEOUT_MS=300000 diff --git a/compute/worker/docker-compose.yml b/compute/worker/docker-compose.yml index dde5a73..1bbf550 100644 --- a/compute/worker/docker-compose.yml +++ b/compute/worker/docker-compose.yml @@ -24,7 +24,7 @@ services: PORT: ${PORT:-8081} COMPUTE_WORKER_TOKEN: ${COMPUTE_WORKER_TOKEN:-local-compute-token} S3_PREFIX: ${S3_PREFIX:-openreader} - COMPUTE_PREWARM_MODELS: ${COMPUTE_PREWARM_MODELS:-true} + COMPUTE_PREWARM_MODELS: ${COMPUTE_PREWARM_MODELS:-false} ports: - "8081:8081" develop: diff --git a/compute/worker/src/runtime.ts b/compute/worker/src/runtime.ts index 1804855..2a43774 100644 --- a/compute/worker/src/runtime.ts +++ b/compute/worker/src/runtime.ts @@ -510,7 +510,7 @@ export async function createComputeWorkerApp(options: CreateComputeWorkerAppOpti const pdfTimeoutMs = timeoutConfig.pdfTimeoutMs; const pdfHardCapMs = timeoutConfig.pdfHardCapMs; const pdfAttempts = readIntEnv('COMPUTE_PDF_JOB_ATTEMPTS', 1); - const prewarmModels = parseBoolEnv('COMPUTE_PREWARM_MODELS', true); + const prewarmModels = parseBoolEnv('COMPUTE_PREWARM_MODELS', false); const jobsStreamMaxBytes = readIntEnv('COMPUTE_JOBS_STREAM_MAX_BYTES', 256 * 1024 * 1024); const eventsStreamMaxBytes = readIntEnv('COMPUTE_EVENTS_STREAM_MAX_BYTES', 128 * 1024 * 1024); const jobStatesMaxBytes = readIntEnv('COMPUTE_JOB_STATES_MAX_BYTES', 64 * 1024 * 1024); diff --git a/docs-site/docs/deploy/compute-worker.md b/docs-site/docs/deploy/compute-worker.md index 260158b..b5ec152 100644 --- a/docs-site/docs/deploy/compute-worker.md +++ b/docs-site/docs/deploy/compute-worker.md @@ -51,7 +51,7 @@ Common optional variables: - `COMPUTE_WORKER_HOST=0.0.0.0` - `PORT=8081` for local/manual runs. Platforms like Railway usually inject `PORT`. - `LOG_FORMAT=json` and `COMPUTE_LOG_LEVEL=info` -- `COMPUTE_PREWARM_MODELS=true` +- `COMPUTE_PREWARM_MODELS=false` by default. Set it to `true` to pre-download ONNX models during worker startup. - `COMPUTE_JOB_CONCURRENCY=1` - `COMPUTE_WHISPER_TIMEOUT_MS=30000` - `COMPUTE_PDF_TIMEOUT_MS=300000`