Files
copilotkit__copilotkit/showcase/starters/ms-agent-python/Dockerfile
Jordan Ritter cffecf1fc1 fix: resolve 3 starter crash root causes — Docker home dir, path depth, import rewriting
1. EACCES on /home/app: Dockerfile templates now create home dir for
   non-root user before USER app (langgraph-ts, claude-sdk-ts, mastra)
2. IndexError Path.parents[4]: search_flights.py schema fallback now
   guards against shallow Docker paths (agno, claude-sdk-py, ms-agent-py)
3. Wrong import path: rewritePythonImports() now converts
   from agents.X to relative imports in starter agent dirs (langroid, crewai)
2026-04-15 09:27:08 -07:00

49 lines
1.4 KiB
Docker
Generated

# Stage 1: Build Next.js frontend
FROM node:22-slim AS frontend
WORKDIR /app
COPY package.json ./
RUN npm install --legacy-peer-deps
COPY src/ ./src/
COPY next.config.ts tsconfig.json postcss.config.mjs ./
RUN npm run build
# Stage 2: Production image with Node.js + Python
FROM python:3.12.13-slim AS runner
RUN apt-get update && apt-get install -y --no-install-recommends \
curl && \
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Python dependencies
COPY agent/requirements.txt ./agent/requirements.txt
RUN pip install --no-cache-dir -r agent/requirements.txt
# Next.js build artifacts
COPY --from=frontend /app/.next ./.next
COPY --from=frontend /app/node_modules ./node_modules
COPY --from=frontend /app/package.json ./
# Agent code (self-contained — tools + data bundled inside)
COPY agent/ ./agent/
# FastAPI agent server entrypoint
COPY agent_server.py ./
# Entrypoint
COPY entrypoint.sh ./
RUN chmod +x entrypoint.sh
RUN (groupadd --system --gid 1001 app 2>/dev/null || true) && (useradd --system --uid 1001 --gid 1001 --no-create-home app 2>/dev/null || true)
RUN mkdir -p /home/app && chown app:app /home/app
RUN mkdir -p /app/.langgraph_api && chown -R app:app /app
USER app
EXPOSE 10000
ENV NODE_ENV=production
ENV PORT=10000
ENV HOSTNAME=0.0.0.0
CMD ["./entrypoint.sh"]