Skip to content

Commit 9a881aa

Browse files
update docker
1 parent 112261d commit 9a881aa

File tree

7 files changed

+147
-129
lines changed

7 files changed

+147
-129
lines changed

Dockerfile

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -70,39 +70,65 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
7070
# Create app directory
7171
WORKDIR /app
7272

73+
# Upgrade pip and install build tools
74+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
75+
7376
# Copy Python dependencies installation info from README
74-
# Install Python dependencies
77+
# Install Python dependencies in stages to avoid timeout and memory issues
78+
79+
# Stage 1: Install PyTorch CPU version first (largest package)
80+
# Using official PyTorch CPU index for smaller size
81+
RUN pip install --no-cache-dir --default-timeout=100 torch --index-url https://download.pytorch.org/whl/cpu
82+
83+
# Stage 2: Install core dependencies
7584
RUN pip install --no-cache-dir \
7685
fastapi \
7786
uvicorn \
7887
boto3 \
7988
botocore \
8089
openai \
81-
ddgs \
82-
rich \
90+
requests
91+
92+
# Stage 3: Install data processing libraries
93+
RUN pip install --no-cache-dir \
8394
numpy \
84-
openpyxl \
85-
biopython \
86-
mammoth \
87-
markdownify \
8895
pandas \
96+
openpyxl \
8997
pdfminer-six \
9098
python-pptx \
9199
pdf2image \
92-
puremagic \
100+
puremagic
101+
102+
# Stage 4: Install document and media processing
103+
RUN pip install --no-cache-dir \
104+
biopython \
105+
mammoth \
106+
markdownify \
93107
pydub \
94-
SpeechRecognition \
108+
SpeechRecognition
109+
110+
# Stage 5: Install web scraping and search
111+
RUN pip install --no-cache-dir \
112+
ddgs \
95113
bs4 \
96114
youtube-transcript-api \
97-
requests \
115+
selenium \
116+
helium
117+
118+
# Stage 6: Install AI/ML libraries
119+
RUN pip install --no-cache-dir \
98120
transformers \
99121
protobuf \
100122
langchain_openai \
101123
langchain \
102-
selenium \
103-
helium \
104124
smolagents
105125

126+
# Stage 7: Install utilities
127+
RUN pip install --no-cache-dir rich
128+
129+
# Pre-download and cache the Qwen tokenizer to avoid download on first run
130+
RUN python3 -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('Qwen/Qwen3-32B')"
131+
106132
# Copy the entire project
107133
COPY . /app/
108134

@@ -121,25 +147,9 @@ RUN mkdir -p test_output ck_pro/ck_web/_web/DownloadedFiles ck_pro/ck_web/_web/s
121147
# 3001 for Playwright web service
122148
EXPOSE 8080 3001
123149

124-
# Create startup script
125-
RUN echo '#!/bin/bash\n\
126-
set -e\n\
127-
\n\
128-
# Start the Playwright web service in background\n\
129-
echo "Starting Playwright web service on port 3001..."\n\
130-
cd /app/ck_pro/ck_web/_web\n\
131-
LISTEN_PORT=3001 npm start &\n\
132-
WEB_PID=$!\n\
133-
\n\
134-
# Wait for web service to be ready\n\
135-
echo "Waiting for web service to start..."\n\
136-
sleep 5\n\
137-
\n\
138-
# Start the FastAPI service\n\
139-
echo "Starting FastAPI service on port 8080..."\n\
140-
cd /app\n\
141-
exec uvicorn agentcompass_service_fastapi:app --host 0.0.0.0 --port 8080 --workers ${WORKERS:-4}\n\
142-
' > /app/start.sh && chmod +x /app/start.sh
150+
# Copy startup script
151+
COPY start.sh /app/start.sh
152+
RUN chmod +x /app/start.sh
143153

144154
# Set environment variables
145155
ENV PYTHONPATH=/app
@@ -154,4 +164,3 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
154164

155165
# Run the startup script
156166
CMD ["/app/start.sh"]
157-

ck_pro/ck_web/_web/server.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ app.post('/getBrowser', async (req, res) => {
147147
let browserEntry = browserPool[availableBrowserslot];
148148
if (!browserEntry.browser) {
149149
chromium.use(StealthPlugin())
150-
const new_browser = await chromium.launch({headless: true, chromiumSandbox: true});
150+
const new_browser = await chromium.launch({
151+
headless: true,
152+
chromiumSandbox: false,
153+
args: [
154+
'--no-sandbox',
155+
'--disable-setuid-sandbox',
156+
'--disable-dev-shm-usage'
157+
]
158+
});
151159
browserEntry.browser = await new_browser.newContext({
152160
viewport: {width: 1024, height: 768},
153161
locale: 'en-US', // Set the locale to English (US)

docker/build-and-push.sh

Lines changed: 0 additions & 96 deletions
This file was deleted.

readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ Key variables you may want to set:
4141
- WEB_IP: host:port for the web browser service (default: localhost:3001)
4242
- Provider keys if using Azure OpenAI or others (see upstream README for details)
4343

44+
### Agent Configuration
45+
46+
All agents in this project are configured with the following default settings:
47+
- **max_steps**: 10 - Maximum number of steps each agent can take to solve a task
48+
- This applies to all agents: CKAgent (main agent), WebAgent, and FileAgent
49+
- The actual execution may allow slightly more steps (up to 1.5x) to compensate for error recovery
50+
- You can override this at runtime by passing `max_steps` parameter to the agent's `run()` method
51+
4452

4553
## 3) Run the API server
4654
- Recommended (multiple workers):

requirements.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Core FastAPI dependencies
2+
fastapi
3+
uvicorn
4+
5+
# AWS SDK
6+
boto3
7+
botocore
8+
9+
# OpenAI and LLM
10+
openai
11+
transformers
12+
protobuf
13+
14+
# LangChain
15+
langchain_openai
16+
langchain
17+
18+
# AI Agents
19+
smolagents
20+
21+
# Search engines
22+
ddgs
23+
24+
# Web scraping and automation
25+
selenium
26+
helium
27+
bs4
28+
requests
29+
30+
# Data processing
31+
numpy
32+
pandas
33+
openpyxl
34+
35+
# Document processing
36+
pdfminer-six
37+
python-pptx
38+
pdf2image
39+
biopython
40+
mammoth
41+
markdownify
42+
puremagic
43+
44+
# Media processing
45+
pydub
46+
SpeechRecognition
47+
48+
# YouTube
49+
youtube-transcript-api
50+
51+
# Utilities
52+
rich
53+
54+
# PyTorch CPU version (must be installed separately with --index-url)
55+
# torch --index-url https://download.pytorch.org/whl/cpu
56+

start.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Get the directory where this script is located
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
# Start the Playwright web service in background
8+
echo "Starting Playwright web service on port 3001..."
9+
cd "$SCRIPT_DIR/ck_pro/ck_web/_web"
10+
LISTEN_PORT=3001 npm start &
11+
WEB_PID=$!
12+
13+
# Wait for web service to be ready
14+
echo "Waiting for web service to start..."
15+
sleep 5
16+
17+
# Start the FastAPI service
18+
echo "Starting FastAPI service on port 8080..."
19+
cd "$SCRIPT_DIR"
20+
exec uvicorn agentcompass_service_fastapi:app --host 0.0.0.0 --port 8080 --workers ${WORKERS:-4}

test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 1. 获取浏览器
2+
BROWSER_ID=$(curl -s -X POST http://localhost:3001/getBrowser \
3+
-H "Content-Type: application/json" \
4+
-d '{}' | grep -o '"browserId":"[^"]*"' | cut -d'"' -f4)
5+
6+
echo "Browser ID: $BROWSER_ID"
7+
8+
# 2. 打开页面
9+
curl -s -X POST http://localhost:3001/openPage \
10+
-H "Content-Type: application/json" \
11+
-d "{\"browserId\":\"$BROWSER_ID\",\"url\":\"https://www.google.com\"}"
12+
13+
# 应该返回: {"browserId":"xxx","pageId":"0"}

0 commit comments

Comments
 (0)