@@ -36,7 +36,8 @@ RUN pnpm install --frozen-lockfile
3636COPY . .
3737
3838# Build the project
39- RUN pnpm exec tsc
39+ # Your package.json must contain a "build" script, such as `"build": "tsc"`
40+ RUN pnpm build
4041
4142# Create a non-privileged user that the app will run under
4243# See https://docs.docker.com/develop/develop-images/dockerfile_best_practices/#user
@@ -49,16 +50,17 @@ RUN adduser \
4950 --uid "${UID}" \
5051 appuser
5152
52- # Ensure ownership of app files and drop privileges for better security
53+ # Set proper permissions
5354RUN chown -R appuser:appuser /app
5455USER appuser
5556
5657# Pre-download any ML models or files the agent needs
5758# This ensures the container is ready to run immediately without downloading
5859# dependencies at runtime, which improves startup time and reliability
59- RUN pnpm exec node dist/agent.js download-files
60+ # Your package.json must contain a "download-files" script, such as `"download-files": "pnpm run build && node dist/agent.js download-files"`
61+ RUN pnpm download-files
6062
61- # Remove development-only dependencies to reduce the runtime image size
63+ # Switch back to root to remove dev dependencies and finalize setup
6264USER root
6365RUN pnpm prune --prod && chown -R appuser:appuser /app
6466USER appuser
@@ -68,4 +70,5 @@ ENV NODE_ENV=production
6870
6971# Run the application
7072# The "start" command tells the worker to connect to LiveKit and begin waiting for jobs.
71- CMD [ "pnpm" , "exec" , "node" , "dist/agent.js" , "start" ]
73+ # Your package.json must contain a "start" script, such as `"start": "node dist/agent.js start"`
74+ CMD [ "pnpm" , "start" ]
0 commit comments