Files
Kazuki Yamada 5c55597512 docs(core): Replace tiktoken references with gpt-tokenizer
Update all documentation, build configuration, and source comments
to reflect the completed migration from tiktoken to gpt-tokenizer.

- Update tokenCount.encoding description to say "OpenAI-compatible
  tokenization" with gpt-tokenizer link (README + 15 language docs)
- Remove tiktoken from bundling external deps list since
  gpt-tokenizer is pure JS (README + 15 language docs)
- Remove tiktoken COPY from Dockerfile and external from bundle.mjs
- Simplify source code comments removing migration artifacts
- Regenerate scripts/memory/package-lock.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 15:37:26 +09:00

63 lines
1.9 KiB
Docker

# ==============================================================================
# Build stage
# ==============================================================================
FROM node:24-alpine AS builder
# Install git (required for GitHub-based npm dependencies)
RUN apk add --no-cache git
# Downgrade npm to avoid --min-release-age conflict with --before for git deps
RUN npm install -g npm@11.4.0
WORKDIR /app
COPY package*.json ./
# Install all dependencies (including dev dependencies for build)
RUN npm ci
# Copy source code and bundle
COPY . .
RUN npm run bundle
# ==============================================================================
# Runtime image
# ==============================================================================
FROM node:24-alpine
# Install git and ca-certificates (required by repomix for remote repository processing)
RUN apk add --no-cache git ca-certificates
# Downgrade npm to avoid --min-release-age conflict with --before for git deps (used by compose dev command)
RUN npm install -g npm@11.4.0
WORKDIR /app
# Copy bundled server and WASM files
COPY --from=builder /app/dist-bundled ./dist-bundled
# Copy external dependencies (cannot be bundled due to runtime requirements)
# - tinypool: spawns worker threads using file paths
COPY --from=builder /app/node_modules/tinypool ./node_modules/tinypool
# Copy warmup script for compile cache generation
COPY --from=builder /app/warmup.mjs ./warmup.mjs
# Set environment variables for bundled mode
# NODE_COMPILE_CACHE enables V8 compile cache to reduce cold start latency
ENV NODE_ENV=production \
PORT=8080 \
REPOMIX_WORKER_PATH=/app/dist-bundled/worker.mjs \
REPOMIX_WASM_DIR=/app/dist-bundled/wasm \
NODE_COMPILE_CACHE=/app/.compile-cache
# Generate compile cache at build time
# This pre-compiles all modules so cold starts use cached compiled code
RUN node warmup.mjs
# Expose port
EXPOSE 8080
# Start the bundled server
CMD ["node", "dist-bundled/server.mjs"]