forked from SeyhanYildiz/DeepCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (73 loc) · 2.74 KB
/
Copy pathDockerfile
File metadata and controls
90 lines (73 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# =============================================================
# DeepCode - Docker Build
# Multi-stage: Frontend build → Final image with Python + Node
# =============================================================
# ------ Stage 1: Build frontend static assets ------
FROM node:18-alpine AS frontend-builder
WORKDIR /build
COPY new_ui/frontend/package*.json ./
RUN npm ci --no-audit --no-fund
COPY new_ui/frontend/ ./
RUN npm run build
# ------ Stage 2: Final image ------
FROM python:3.10-slim
# Metadata
LABEL maintainer="DeepCode Team"
LABEL description="DeepCode - AI Research Engine"
LABEL version="1.0"
# Environment
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
DEEPCODE_ENV=docker \
DEEPCODE_HOST=0.0.0.0 \
DEEPCODE_PORT=8000
# Install system dependencies:
# - git: for git clone operations in workflows
# - nodejs/npm/npx: for MCP servers (brave-search, filesystem, fetch)
# - curl: for health checks
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates && \
# Install Node.js 18 via official binary (includes npm + npx)
ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "arm64" ]; then NODE_ARCH="arm64"; else NODE_ARCH="x64"; fi && \
curl -fsSL https://nodejs.org/dist/v18.20.8/node-v18.20.8-linux-${NODE_ARCH}.tar.gz \
| tar -xz -C /usr/local --strip-components=1 && \
# Install uv (Python package installer, used by mcp-server-fetch)
pip install --no-cache-dir uv && \
# Cleanup
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Verify
node --version && npm --version && npx --version
WORKDIR /app
# Install Python dependencies first (cache layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-install npx MCP server packages (avoid download at runtime)
RUN npx -y @modelcontextprotocol/server-brave-search --help 2>/dev/null || true && \
npx -y @modelcontextprotocol/server-filesystem --help 2>/dev/null || true
# Copy project source code
COPY __init__.py setup.py deepcode.py ./
COPY config/ ./config/
COPY prompts/ ./prompts/
COPY schema/ ./schema/
COPY tools/ ./tools/
COPY utils/ ./utils/
COPY workflows/ ./workflows/
COPY cli/ ./cli/
COPY ui/ ./ui/
COPY new_ui/backend/ ./new_ui/backend/
# Copy frontend build output from Stage 1
COPY --from=frontend-builder /build/dist ./new_ui/frontend/dist
# Create runtime directories
RUN mkdir -p deepcode_lab uploads logs
# Copy entrypoint script
COPY deepcode_docker/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
ENTRYPOINT ["/docker-entrypoint.sh"]