Skip to content

Commit 383df7e

Browse files
authored
Cache download-files in Dockerfile and simplify the download-files script (#49)
* Cache download-files in Dockerfile and drop redundant build step from script * Drop download-files script and call npx livekit-agents directly in Dockerfile
1 parent 3521bef commit 383df7e

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ COPY package.json pnpm-lock.yaml ./
3434
# --frozen-lockfile ensures we use exact versions from pnpm-lock.yaml for reproducible builds
3535
RUN pnpm install --frozen-lockfile
3636

37+
# Pre-download any ML models or files the agent needs
38+
# This runs before COPY . . so the download layer is cached across code-only changes.
39+
# The standalone CLI discovers installed @livekit/agents-plugin-* packages without
40+
# loading your agent code.
41+
RUN npx livekit-agents download-files
42+
3743
# Copy all remaining application files into the container
3844
# This includes source code, configuration files, and dependency specifications
3945
# (Excludes files specified in .dockerignore)
@@ -43,12 +49,6 @@ COPY . .
4349
# Your package.json must contain a "build" script, such as `"build": "tsc"`
4450
RUN pnpm build
4551

46-
# Pre-download any ML models or files the agent needs
47-
# This ensures the container is ready to run immediately without downloading
48-
# dependencies at runtime, which improves startup time and reliability
49-
# Your package.json must contain a "download-files" script, such as `"download-files": "pnpm run build && node dist/agent.js download-files"`
50-
RUN pnpm download-files
51-
5252
# Remove dev dependencies for a leaner production image
5353
RUN pnpm prune --prod
5454

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"test": "vitest --run",
1515
"test:watch": "vitest",
1616
"dev": "pnpm run build && node dist/main.js dev",
17-
"download-files": "pnpm run build && npx livekit-agents download-files",
1817
"start": "node dist/main.js start"
1918
},
2019
"engines": {

0 commit comments

Comments
 (0)