Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ RUN --mount=type=cache,target=/root/.cache/uv \

FROM debian:bookworm-slim AS runtime

ARG VNC_PASSWORD="browser-use"
# VNC password will be read from Docker secrets or fallback to default
# Create a fallback default password file
RUN mkdir -p /run/secrets && \
echo "browser-use" > /run/secrets/vnc_password_default

# Install required packages including Chromium and clean up in the same layer
RUN apt-get update && \
Expand All @@ -35,8 +38,6 @@ RUN apt-get update && \
tigervnc-tools \
nodejs \
npm \
chromium \
chromium-driver \
fonts-freefont-ttf \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
Expand All @@ -56,18 +57,16 @@ COPY --from=builder --chown=app:app /app /app
ENV PATH="/app/.venv/bin:$PATH" \
DISPLAY=:0 \
CHROME_BIN=/usr/bin/chromium \
CHROMIUM_FLAGS="--no-sandbox --headless --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage" \
CHROME_PATH="/usr/bin/chromium"
CHROMIUM_FLAGS="--no-sandbox --headless --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage"

# Combine VNC setup commands to reduce layers
RUN mkdir -p ~/.vnc && \
echo $VNC_PASSWORD | vncpasswd -f > /root/.vnc/passwd && \
chmod 600 /root/.vnc/passwd && \
printf '#!/bin/sh\nunset SESSION_MANAGER\nunset DBUS_SESSION_BUS_ADDRESS\nstartxfce4' > /root/.vnc/xstartup && \
chmod +x /root/.vnc/xstartup && \
printf '#!/bin/bash\nvncserver -depth 24 -geometry 1920x1080 -localhost no -PasswordFile /root/.vnc/passwd :0\nproxy-login-automator\npython /app/server --port 8000' > /app/boot.sh && \
printf '#!/bin/bash\n\n# Use Docker secret for VNC password if available, else fallback to default\nif [ -f "/run/secrets/vnc_password" ]; then\n cat /run/secrets/vnc_password | vncpasswd -f > /root/.vnc/passwd\nelse\n cat /run/secrets/vnc_password_default | vncpasswd -f > /root/.vnc/passwd\nfi\n\nchmod 600 /root/.vnc/passwd\nvncserver -depth 24 -geometry 1920x1080 -localhost no -PasswordFile /root/.vnc/passwd :0\nproxy-login-automator\npython /app/server --port 8000' > /app/boot.sh && \
chmod +x /app/boot.sh

RUN playwright install --with-deps --no-shell chromium

EXPOSE 8000

Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ CHROME_PATH=[only change this if you have a custom chrome build]
- we will be adding support for other LLM providers to power browser-use
(claude, grok, bedrock, etc)

when building the dockerfile you can add in your own VNC server password:
when building the docker image, you can use Docker secrets for VNC password:

```
docker build --build-arg VNC_PASSWORD=klaatubaradanikto .
# With Docker secrets (recommended for production)
echo "your-secure-password" > vnc_password.txt
docker run -v $(pwd)/vnc_password.txt:/run/secrets/vnc_password your-image-name

# Or during development with the default password
docker build .
```

### tools
Expand Down
Loading