Cache download-files in Dockerfile by using the module-level command (#79)
This commit is contained in:
+6
-5
@@ -48,16 +48,17 @@ RUN mkdir -p src
|
|||||||
# Ensure your uv.lock file is checked in for consistency across environments
|
# Ensure your uv.lock file is checked in for consistency across environments
|
||||||
RUN uv sync --locked
|
RUN uv sync --locked
|
||||||
|
|
||||||
|
# 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 module-level command discovers installed livekit-plugins-* packages without
|
||||||
|
# loading your agent code.
|
||||||
|
RUN uv run --module livekit.agents download-files
|
||||||
|
|
||||||
# Copy all remaining application files into the container
|
# Copy all remaining application files into the container
|
||||||
# This includes source code, configuration files, and dependency specifications
|
# This includes source code, configuration files, and dependency specifications
|
||||||
# (Excludes files specified in .dockerignore)
|
# (Excludes files specified in .dockerignore)
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 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
|
|
||||||
RUN uv run "src/agent.py" download-files
|
|
||||||
|
|
||||||
# --- Production stage ---
|
# --- Production stage ---
|
||||||
# Build tools (gcc, g++, python3-dev) are not included in the final image
|
# Build tools (gcc, g++, python3-dev) are not included in the final image
|
||||||
FROM base
|
FROM base
|
||||||
|
|||||||
Reference in New Issue
Block a user