Skip to content

Commit b7c8fe1

Browse files
committed
fix dockerfile
1 parent 483d20a commit b7c8fe1

File tree

6 files changed

+47
-46
lines changed

6 files changed

+47
-46
lines changed

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
data
2-
tmp
2+
tmp
3+
results
4+
5+
.env

Dockerfile

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM python:3.11-slim
22

33
# Set platform for multi-arch builds (Docker Buildx will set this)
44
ARG TARGETPLATFORM
5+
ARG NODE_MAJOR=20
56

67
# Install system dependencies
78
RUN apt-get update && apt-get install -y \
@@ -42,22 +43,33 @@ RUN apt-get update && apt-get install -y \
4243
fonts-dejavu \
4344
fonts-dejavu-core \
4445
fonts-dejavu-extra \
46+
vim \
4547
&& rm -rf /var/lib/apt/lists/*
4648

4749
# Install noVNC
4850
RUN git clone https://github.com/novnc/noVNC.git /opt/novnc \
4951
&& git clone https://github.com/novnc/websockify /opt/novnc/utils/websockify \
5052
&& ln -s /opt/novnc/vnc.html /opt/novnc/index.html
5153

54+
# Install Node.js using NodeSource PPA
55+
RUN mkdir -p /etc/apt/keyrings \
56+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
57+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
58+
&& apt-get update \
59+
&& apt-get install nodejs -y \
60+
&& rm -rf /var/lib/apt/lists/*
61+
62+
# Verify Node.js and npm installation (optional, but good for debugging)
63+
RUN node -v && npm -v && npx -v
64+
5265
# Set up working directory
5366
WORKDIR /app
5467

5568
# Copy requirements and install Python dependencies
5669
COPY requirements.txt .
5770
# Ensure 'patchright' is in your requirements.txt or install it directly
5871
# RUN pip install --no-cache-dir -r requirements.txt patchright # If not in requirements
59-
RUN pip install --no-cache-dir -r requirements.txt # Assuming patchright is in requirements.txt
60-
RUN pip install --no-cache-dir patchright # Or install it explicitly
72+
RUN pip install --no-cache-dir -r requirements.txt
6173

6274
# Install Patchright browsers and dependencies
6375
# Patchright documentation suggests PLAYWRIGHT_BROWSERS_PATH is still relevant
@@ -69,32 +81,19 @@ RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH
6981
# Install recommended: Google Chrome (instead of just Chromium for better undetectability)
7082
# The 'patchright install chrome' command might download and place it.
7183
# The '--with-deps' equivalent for patchright install is to run 'patchright install-deps chrome' after.
72-
RUN patchright install chrome
73-
RUN patchright install-deps chrome
84+
RUN patchright install chrome --with-deps
7485

7586
# Alternative: Install Chromium if Google Chrome is problematic in certain environments
76-
RUN patchright install chromium
77-
RUN patchright install-deps chromium
87+
RUN patchright install chromium --with-deps
7888

7989
# Copy the application code
8090
COPY . .
8191

82-
# Set environment variables (Updated Names)
83-
ENV PYTHONUNBUFFERED=1
84-
ENV BROWSER_USE_LOGGING_LEVEL=info
85-
# BROWSER_PATH will be determined by Patchright installation, supervisord will find it.
86-
ENV ANONYMIZED_TELEMETRY=false
87-
ENV DISPLAY=:99
88-
ENV RESOLUTION=1920x1080x24
89-
ENV VNC_PASSWORD=youvncpassword
90-
ENV KEEP_BROWSER_OPEN=true
91-
ENV RESOLUTION_WIDTH=1920
92-
ENV RESOLUTION_HEIGHT=1080
93-
9492
# Set up supervisor configuration
9593
RUN mkdir -p /var/log/supervisor
9694
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
9795

9896
EXPOSE 7788 6080 5901 9222
9997

100-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
98+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
99+
#CMD ["/bin/bash"]

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ uv pip install -r requirements.txt
6363

6464
Install Browsers in Patchright.
6565
```bash
66-
patchright install
66+
patchright install --with-deps
6767
```
6868
Or you can install specific browsers by running:
6969
```bash
70-
patchright install chromium --with-deps --no-shell
70+
patchright install chromium --with-deps
7171
```
7272

7373
#### Step 4: Configure Environment
@@ -82,25 +82,24 @@ cp .env.example .env
8282
```
8383
2. Open `.env` in your preferred text editor and add your API keys and other settings
8484

85-
#### Local Setup
85+
#### Step 5: Enjoy the web-ui
8686
1. **Run the WebUI:**
87-
After completing the installation steps above, start the application:
8887
```bash
8988
python webui.py --ip 127.0.0.1 --port 7788
9089
```
9190
2. **Access the WebUI:** Open your web browser and navigate to `http://127.0.0.1:7788`.
9291
3. **Using Your Own Browser(Optional):**
93-
- Set `CHROME_PATH` to the executable path of your browser and `CHROME_USER_DATA` to the user data directory of your browser. Leave `CHROME_USER_DATA` empty if you want to use local user data.
92+
- Set `BROWSER_PATH` to the executable path of your browser and `BROWSER_USER_DATA` to the user data directory of your browser. Leave `BROWSER_USER_DATA` empty if you want to use local user data.
9493
- Windows
9594
```env
96-
CHROME_PATH="C:\Program Files\Google\Chrome\Application\chrome.exe"
97-
CHROME_USER_DATA="C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data"
95+
BROWSER_PATH="C:\Program Files\Google\Chrome\Application\chrome.exe"
96+
BROWSER_USER_DATA="C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data"
9897
```
9998
> Note: Replace `YourUsername` with your actual Windows username for Windows systems.
10099
- Mac
101100
```env
102-
CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
103-
CHROME_USER_DATA="/Users/YourUsername/Library/Application Support/Google/Chrome"
101+
BROWSER_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
102+
BROWSER_USER_DATA="/Users/YourUsername/Library/Application Support/Google/Chrome"
104103
```
105104
- Close all Chrome windows
106105
- Open the WebUI in a non-Chrome browser, such as Firefox or Edge. This is important because the persistent browser context will use the Chrome data when running the agent.
@@ -113,14 +112,14 @@ cp .env.example .env
113112
- [Docker Desktop](https://www.docker.com/products/docker-desktop/) (For Windows/macOS)
114113
- [Docker Engine](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) (For Linux)
115114

116-
#### Installation Steps
117-
1. Clone the repository:
115+
#### Step 1: Clone the Repository
118116
```bash
119117
git clone https://github.com/browser-use/web-ui.git
120118
cd web-ui
121119
```
122120

123-
2. Create and configure environment file:
121+
#### Step 2: Configure Environment
122+
1. Create a copy of the example environment file:
124123
- Windows (Command Prompt):
125124
```bash
126125
copy .env.example .env
@@ -129,25 +128,23 @@ copy .env.example .env
129128
```bash
130129
cp .env.example .env
131130
```
132-
Edit `.env` with your preferred text editor and add your API keys
131+
2. Open `.env` in your preferred text editor and add your API keys and other settings
133132

134-
3. Run with Docker:
133+
#### Step 3: Docker Build and Run
135134
```bash
136-
# Build and start the container with default settings (browser closes after AI tasks)
137135
docker compose up --build
138136
```
137+
For ARM64 systems (e.g., Apple Silicon Macs), please run follow command:
139138
```bash
140-
# Or run with persistent browser (browser stays open between AI tasks)
141-
CHROME_PERSISTENT_SESSION=true docker compose up --build
139+
TARGETPLATFORM=linux/arm64 docker compose up --build
142140
```
143141

144-
4. Access the Application:
145-
- Web Interface: Open `http://localhost:7788` in your browser
142+
#### Step 4: Enjoy the web-ui and vnc
143+
- Web-UI: Open `http://localhost:7788` in your browser
146144
- VNC Viewer (for watching browser interactions): Open `http://localhost:6080/vnc.html`
147145
- Default VNC password: "youvncpassword"
148146
- Can be changed by setting `VNC_PASSWORD` in your `.env` file
149147

150-
151148
## Changelog
152149
- [x] **2025/01/26:** Thanks to @vvincent1234. Now browser-use-webui can combine with DeepSeek-r1 to engage in deep thinking!
153150
- [x] **2025/01/10:** Thanks to @casistack. Now we have Docker Setup option and also Support keep browser open between tasks.[Video tutorial demo](https://github.com/browser-use/web-ui/issues/1#issuecomment-2582511750).

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
services:
2+
# debug: docker compose run --rm -it browser-use-webui bash
23
browser-use-webui:
34
build:
45
context: .
@@ -11,7 +12,7 @@ services:
1112
- "5901:5901"
1213
- "9222:9222"
1314
environment:
14-
# LLM API Keys & Endpoints (Your existing list)
15+
# LLM API Keys & Endpoints
1516
- OPENAI_ENDPOINT=${OPENAI_ENDPOINT:-https://api.openai.com/v1}
1617
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
1718
- ANTHROPIC_ENDPOINT=${ANTHROPIC_ENDPOINT:-https://api.anthropic.com}
@@ -42,7 +43,8 @@ services:
4243
- BROWSER_USE_LOGGING_LEVEL=${BROWSER_USE_LOGGING_LEVEL:-info}
4344

4445
# Browser Settings
45-
- BROWSER_USER_DATA=${BROWSER_USER_DATA:-/app/data/chrome_data}
46+
- BROWSER_PATH=/usr/bin/google-chrome
47+
- BROWSER_USER_DATA=/app/data/chrome_data
4648
- BROWSER_DEBUGGING_PORT=${BROWSER_DEBUGGING_PORT:-9222}
4749
- BROWSER_DEBUGGING_HOST=${BROWSER_DEBUGGING_HOST:-0.0.0.0}
4850
- KEEP_BROWSER_OPEN=${KEEP_BROWSER_OPEN:-true}

supervisord.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ user=root
33
nodaemon=true
44
logfile=/dev/stdout
55
logfile_maxbytes=0
6-
loglevel=debug
6+
loglevel=error
77

88
[program:xvfb]
99
command=Xvfb :99 -screen 0 %(ENV_RESOLUTION)s -ac +extension GLX +render -noreset

tests/test_llm_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ def test_ibm_model():
142142

143143

144144
def test_qwen_model():
145-
config = LLMConfig(provider="alibaba", model_name="qwen3-30b-a3b")
145+
config = LLMConfig(provider="alibaba", model_name="qwen-vl-max")
146146
test_llm(config, "How many 'r's are in the word 'strawberry'?")
147147

148148

149149
if __name__ == "__main__":
150150
# test_openai_model()
151151
# test_google_model()
152-
# test_azure_openai_model()
152+
test_azure_openai_model()
153153
# test_deepseek_model()
154154
# test_ollama_model()
155-
test_deepseek_r1_model()
155+
# test_deepseek_r1_model()
156156
# test_deepseek_r1_ollama_model()
157157
# test_mistral_model()
158158
# test_ibm_model()

0 commit comments

Comments
 (0)