mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
53 lines
1.3 KiB
Docker
53 lines
1.3 KiB
Docker
# Stage 1: Build Next.js frontend
|
|
FROM node:20-slim AS frontend
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json ./
|
|
RUN npm install --ignore-scripts
|
|
|
|
COPY src/ ./src/
|
|
COPY public/ ./public/
|
|
COPY next.config.ts tsconfig.json postcss.config.mjs ./
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production image with Python + Node
|
|
FROM python:3.12-slim AS runner
|
|
|
|
# Install Node.js 20 + uv
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends curl ca-certificates && \
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
|
apt-get install -y --no-install-recommends nodejs && \
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh && \
|
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PATH="/root/.local/bin:$PATH"
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Python dependencies using uv (matches local dev)
|
|
COPY agent/pyproject.toml ./agent/pyproject.toml
|
|
COPY agent/main.py ./agent/main.py
|
|
RUN cd agent && uv pip install --system -e .
|
|
|
|
# Copy Next.js build output and production node_modules
|
|
COPY --from=frontend /app/.next ./.next
|
|
COPY --from=frontend /app/node_modules ./node_modules
|
|
COPY --from=frontend /app/package.json ./
|
|
COPY --from=frontend /app/public ./public
|
|
|
|
# Copy agent source code
|
|
COPY agent/ ./agent/
|
|
|
|
# Copy entrypoint
|
|
COPY entrypoint.sh ./
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
CMD ["./entrypoint.sh"]
|