File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ COPY package.json pnpm-lock.yaml ./
3535# --frozen-lockfile ensures we use exact versions from pnpm-lock.yaml for reproducible builds
3636RUN pnpm install --frozen-lockfile
3737
38+ # Pre-download any ML models or files the agent needs
39+ # This runs before COPY . . so the download layer is cached across code-only changes.
40+ # The standalone CLI discovers installed @livekit/agents-plugin-* packages without
41+ # loading your agent code.
42+ RUN npx livekit-agents download-files
43+
3844# Copy all remaining application files into the container
3945# This includes source code, configuration files, and dependency specifications
4046# (Excludes files specified in .dockerignore)
@@ -44,12 +50,6 @@ COPY . .
4450# Your package.json must contain a "build" script, such as `"build": "tsc"`
4551RUN pnpm build
4652
47- # Pre-download any ML models or files the agent needs
48- # This ensures the container is ready to run immediately without downloading
49- # dependencies at runtime, which improves startup time and reliability
50- # Your package.json must contain a "download-files" script, such as `"download-files": "pnpm run build && node dist/agent.js download-files"`
51- RUN pnpm download-files
52-
5353# Remove dev dependencies for a leaner production image
5454RUN pnpm prune --prod
5555
Original file line number Diff line number Diff line change @@ -42,16 +42,17 @@ RUN python -m venv .venv
4242ENV PATH="/app/.venv/bin:$PATH"
4343RUN pip install --no-cache-dir -r requirements.txt
4444
45+ # Pre-download any ML models or files the agent needs
46+ # This runs before COPY . . so the download layer is cached across code-only changes.
47+ # The module-level command discovers installed livekit-plugins-* packages without
48+ # loading your agent code.
49+ RUN python -m livekit.agents download-files
50+
4551# Copy all remaining application files into the container
4652# This includes source code, configuration files, and dependency specifications
4753# (Excludes files specified in .dockerignore)
4854COPY . .
4955
50- # Pre-download any ML models or files the agent needs
51- # This ensures the container is ready to run immediately without downloading
52- # dependencies at runtime, which improves startup time and reliability
53- RUN python "{{.ProgramMain}}" download-files
54-
5556# --- Production stage ---
5657# Build tools (gcc, g++, python3-dev) are not included in the final image
5758FROM base
Original file line number Diff line number Diff line change @@ -46,16 +46,17 @@ RUN mkdir -p src
4646# Ensure your uv.lock file is checked in for consistency across environments
4747RUN uv sync --locked
4848
49+ # Pre-download any ML models or files the agent needs
50+ # This runs before COPY . . so the download layer is cached across code-only changes.
51+ # The module-level command discovers installed livekit-plugins-* packages without
52+ # loading your agent code.
53+ RUN uv run --module livekit.agents download-files
54+
4955# Copy all remaining application files into the container
5056# This includes source code, configuration files, and dependency specifications
5157# (Excludes files specified in .dockerignore)
5258COPY . .
5359
54- # Pre-download any ML models or files the agent needs
55- # This ensures the container is ready to run immediately without downloading
56- # dependencies at runtime, which improves startup time and reliability
57- RUN uv run "{{.ProgramMain}}" download-files
58-
5960# --- Production stage ---
6061# Build tools (gcc, g++, python3-dev) are not included in the final image
6162FROM base
You can’t perform that action at this time.
0 commit comments