Revert "feat: add persistent Deno cache to Railway executor for faster tool loading"

This reverts commit eb8a5ff91e.
This commit is contained in:
Ajax Davis 2025-12-05 01:04:39 +10:00
parent 74811cc269
commit 227a7e2dd1
3 changed files with 3 additions and 40 deletions

View file

@ -4,27 +4,11 @@ FROM denoland/deno:1.39.0
# Set working directory
WORKDIR /app
# 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 the server file
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", "--allow-read", "--allow-write", "server.ts"]
CMD ["deno", "run", "--allow-net", "--allow-env", "server.ts"]

View file

@ -1,14 +0,0 @@
[build]
builder = "dockerfile"
dockerfilePath = "Dockerfile"
[deploy]
startCommand = "deno run --allow-net --allow-env --allow-read --allow-write server.ts"
restartPolicyType = "on_failure"
restartPolicyMaxRetries = 10
# Mount persistent volume for Deno cache
# This persists the cache across deploys and restarts
[[volumes]]
mountPath = "/app/.deno_cache"
name = "deno-cache"

View file

@ -104,14 +104,7 @@ async function loadAndDescribe(req: Request): Promise<Response> {
} else {
// Dynamic import from esm.sh (Deno supports this natively!)
const url = importUrl || `https://esm.sh/${packageName}@${version}`;
// Log cache status for visibility
const isFirstImport = !moduleCache.has(cacheKey);
if (isFirstImport) {
console.log(`📦 Importing from network (will be cached by Deno): ${url}`);
} else {
console.log(`✅ Using in-memory cache: ${url}`);
}
console.log(`📦 Importing: ${url}`);
const module = await import(url);
let rawExport = module[exportName];