| # Use Python 3.11 as the base image. | |
| FROM python:3.11-slim | |
| # Set the working directory inside the container. | |
| WORKDIR /app | |
| # Install system dependencies required for Git and a minimal set for Playwright. | |
| # This list is based on the most common runtime dependencies for headless browsers. | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends \ | |
| git \ | |
| libnss3 \ | |
| libdbus-1-3 \ | |
| libatk1.0-0 \ | |
| libatk-bridge2.0-0 \ | |
| libdrm2 \ | |
| libxcomposite1 \ | |
| libxext6 \ | |
| libxfixes3 \ | |
| libxrandr2 \ | |
| libgbm1 \ | |
| libexpat1 \ | |
| libfontconfig1 \ | |
| libharfbuzz0b \ | |
| libfreetype6 \ | |
| libpng16-16 \ | |
| libjpeg62-turbo \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Clone the web-ui repository from GitHub. | |
| RUN git clone https://github.com/browser-use/web-ui.git | |
| # Set the working directory to the newly cloned repository. | |
| WORKDIR /app/web-ui | |
| # Install uv first, then use it to create the virtual environment and install dependencies. | |
| RUN pip install uv | |
| # Create a virtual environment using uv. | |
| RUN uv venv --python 3.11 | |
| # Set the PATH to include the virtual environment's binary directory. | |
| # ENV PATH="/app/web-ui/.venv/bin:$PATH" | |
| RUN ls -la | |
| #RUN source .venv/bin/activate | |
| RUN ls -la .venv/bin/ | |
| # Install Python dependencies and the Chromium browser with Playwright within the venv. | |
| RUN .venv/bin/python -m ensurepip --upgrade | |
| #RUN source .venv/bin/activate | |
| RUN ls -la .venv/bin/ | |
| RUN .venv/bin/pip3 install uv playwright | |
| #RUN source .venv/bin/activate | |
| RUN ls -la .venv/bin/ | |
| # RUN .venv/bin/uv pip3 install -r requirements.txt \ | |
| RUN .venv/bin/pip3 install -r requirements.txt \ | |
| && .venv/bin/playwright install --with-deps chromium | |
| # Expose the default port for the web application. | |
| EXPOSE 7860 | |
| # Command to run the application when the container starts. | |
| # We bind to 0.0.0.0 to make the web UI accessible from outside the container. | |
| CMD [".venv/bin/python", "webui.py", "--ip", "0.0.0.0", "--port", "7860"] |