From 5c02b4b0bbc756793ee9a508ea9d3eb563d0d319 Mon Sep 17 00:00:00 2001 From: chana Date: Wed, 27 May 2026 12:17:27 -0700 Subject: [PATCH 1/2] Cache download-files in Dockerfile and drop redundant build step from script --- Dockerfile | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a49514..dfc34ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,12 @@ COPY package.json pnpm-lock.yaml ./ # --frozen-lockfile ensures we use exact versions from pnpm-lock.yaml for reproducible builds RUN pnpm install --frozen-lockfile +# Pre-download any ML models or files the agent needs +# This runs before COPY . . so the download layer is cached across code-only changes. +# The standalone CLI discovers installed @livekit/agents-plugin-* packages without +# loading your agent code. +RUN pnpm download-files + # Copy all remaining application files into the container # This includes source code, configuration files, and dependency specifications # (Excludes files specified in .dockerignore) @@ -42,12 +48,6 @@ COPY . . # Your package.json must contain a "build" script, such as `"build": "tsc"` RUN pnpm build -# Pre-download any ML models or files the agent needs -# This ensures the container is ready to run immediately without downloading -# dependencies at runtime, which improves startup time and reliability -# Your package.json must contain a "download-files" script, such as `"download-files": "pnpm run build && node dist/agent.js download-files"` -RUN pnpm download-files - # Remove dev dependencies for a leaner production image RUN pnpm prune --prod diff --git a/package.json b/package.json index fd7af93..21dacf8 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test": "vitest --run", "test:watch": "vitest", "dev": "pnpm run build && node dist/main.js dev", - "download-files": "pnpm run build && npx livekit-agents download-files", + "download-files": "npx livekit-agents download-files", "start": "node dist/main.js start" }, "engines": { From ae9c1487ffd2a54f1e48f5cf3387b08aa52301ed Mon Sep 17 00:00:00 2001 From: chana Date: Thu, 28 May 2026 13:52:47 -0700 Subject: [PATCH 2/2] Drop download-files script and call npx livekit-agents directly in Dockerfile --- Dockerfile | 2 +- package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index dfc34ca..68aa41c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN pnpm install --frozen-lockfile # This runs before COPY . . so the download layer is cached across code-only changes. # The standalone CLI discovers installed @livekit/agents-plugin-* packages without # loading your agent code. -RUN pnpm download-files +RUN npx livekit-agents download-files # Copy all remaining application files into the container # This includes source code, configuration files, and dependency specifications diff --git a/package.json b/package.json index 21dacf8..a12a9fd 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "test": "vitest --run", "test:watch": "vitest", "dev": "pnpm run build && node dist/main.js dev", - "download-files": "npx livekit-agents download-files", "start": "node dist/main.js start" }, "engines": {