feat: add persistent Deno cache to Railway executor for faster tool loading
- Set DENO_DIR=/app/.deno_cache to persist module cache - Pre-cache common dependencies (zod-to-json-schema, ai, zod) during build - Add Railway volume configuration for /app/.deno_cache - Improve logging to show cache hits vs network downloads - Add --allow-read and --allow-write permissions for cache access This dramatically reduces tool loading time after the first import. Dependencies are downloaded once and reused across all subsequent requests. Example: ctx-zip with 200+ dependencies will only download once instead of on every chat request. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1bd484797f
commit
47577a43e5
3 changed files with 40 additions and 3 deletions
|
|
@ -4,11 +4,27 @@ FROM denoland/deno:1.39.0
|
|||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the server file
|
||||
# Set Deno cache directory to persist across requests
|
||||
ENV DENO_DIR=/app/.deno_cache
|
||||
|
||||
# Create cache directory
|
||||
RUN mkdir -p /app/.deno_cache
|
||||
|
||||
# Copy files
|
||||
COPY server.ts .
|
||||
COPY deno.json .
|
||||
|
||||
# Pre-cache zod-to-json-schema (used by server.ts)
|
||||
RUN deno cache --reload \
|
||||
https://esm.sh/zod-to-json-schema@3.25.0
|
||||
|
||||
# Pre-cache common AI SDK dependencies to speed up first loads
|
||||
RUN deno cache --reload \
|
||||
https://esm.sh/ai@5.0.83 \
|
||||
https://esm.sh/zod@3.22.0 || true
|
||||
|
||||
# Expose port (Railway will set PORT env var)
|
||||
EXPOSE 3002
|
||||
|
||||
# Run the Deno server
|
||||
CMD ["deno", "run", "--allow-net", "--allow-env", "server.ts"]
|
||||
CMD ["deno", "run", "--allow-net", "--allow-env", "--allow-read", "--allow-write", "server.ts"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue