forked from VRAutomatize/browser-use
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
171 lines (149 loc) · 4.03 KB
/
Dockerfile
File metadata and controls
171 lines (149 loc) · 4.03 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/root/.local/bin:$PATH"
ENV DISPLAY=:99
ENV DEBIAN_FRONTEND=noninteractive
# Create non-root user
RUN useradd -m -u 1000 appuser && \
mkdir -p /app && \
chown appuser:appuser /app
# Configure apt to be more robust
RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
echo 'Acquire::http::Timeout "120";' >> /etc/apt/apt.conf.d/80retries && \
echo 'Acquire::ftp::Timeout "120";' >> /etc/apt/apt.conf.d/80retries
# Clear cache and install basic dependencies
RUN apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
wget \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# Install system dependencies in stages
RUN apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
xvfb \
libgconf-2-4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libnspr4 \
libnss3 \
&& rm -rf /var/lib/apt/lists/*
# Install only essential fonts
RUN apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
fonts-liberation \
x11-utils \
&& rm -rf /var/lib/apt/lists/*
# Install development dependencies
RUN apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
make \
gcc \
g++ \
git \
procps \
dbus \
curl \
python3-dev \
libpq-dev \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN echo 'source /root/.cargo/env' >> $HOME/.bashrc
# Install additional Playwright dependencies
RUN apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir \
fastapi==0.104.0 \
uvicorn==0.24.0 \
playwright==1.51.0 \
sqlalchemy[postgresql]==2.0.40 \
asyncpg==0.29.0 \
psycopg2-binary==2.9.10 \
python-dotenv==1.0.0 \
pydantic==2.10.4 \
pydantic-settings>=2.1.0 \
python-jose[cryptography]==3.3.0 \
passlib[bcrypt]==1.7.4 \
python-multipart==0.0.6 \
aiohttp==3.9.3 \
httpx==0.25.2 \
psutil==5.9.6 \
alembic==1.12.1 \
greenlet==3.1.1 \
posthog==3.7.0 \
sentence-transformers>=4.0.2 \
mem0ai==0.1.88 \
screeninfo==0.8.1 \
requests>=2.32.3
# Install required LangChain packages
RUN pip install --no-cache-dir langchain==0.3.21
RUN pip install --no-cache-dir langchain_core==0.3.49
RUN pip install --no-cache-dir langchain-openai==0.3.11
# Install Playwright browsers
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/playwright
RUN playwright install --with-deps chromium firefox webkit
RUN playwright install-deps
RUN apt-get install xauth -y
RUN pip install --no-cache-dir langchain-ollama
RUN pip install --no-cache-dir langchain_google_genai==2.1.4
# ensure correct permissions for /tmp/.X11-unix to prevent Xvfb from issuing warnings
RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
# Create directory for logs
RUN mkdir -p /var/log/browser-use && \
chown appuser:appuser /var/log/browser-use
# Set working directory
WORKDIR /app
# Copy application code
COPY . .
# Set permissions
# RUN chown -R appuser:appuser /app
# # Switch to non-root user
# USER appuser
# Expose port
EXPOSE 9000
# Command to start the application
CMD ["./start.sh"]