File size: 2,378 Bytes
d7d2934
8a43ca9
d9afe4b
d7d2934
 
d9afe4b
1727112
d9afe4b
cdfc8b3
 
1727112
 
cdfc8b3
1727112
 
 
 
cdfc8b3
1727112
cdfc8b3
 
 
1727112
 
 
 
cdfc8b3
c273690
 
 
cdfc8b3
d9afe4b
1727112
69210ea
049f904
d9afe4b
a1af082
5acd02d
8e36933
5acd02d
 
3da3e4c
cdfc8b3
 
 
 
 
 
 
 
 
 
 
 
 
 
d9afe4b
 
 
2971656
d9afe4b
 
 
 
3da3e4c
1727112
78be0d3
1727112
d9afe4b
 
 
 
c273690
 
 
 
 
 
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
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04

# Environment settings
ENV DEBIAN_FRONTEND=noninteractive \
    TZ=Asia/Kolkata \
    PYTHONUNBUFFERED=1

# Install required OS packages (minimal set)
RUN rm -f /etc/apt/sources.list.d/*.list && \
    apt-get update && apt-get install -y --no-install-recommends \
    curl \
    ca-certificates \
    sudo \
    git \
    wget \
    procps \
    git-lfs \
    zip \
    unzip \
    htop \
    vim \
    nano \
    bzip2 \
    libx11-6 \
    build-essential \
    libsndfile-dev \
    software-properties-common \
    xfce4 xfce4-goodies \
    x11vnc \
    novnc websockify \
 && rm -rf /var/lib/apt/lists/*

# Clone repository
RUN git clone https://github.com/browser-use/web-ui.git /web-ui
WORKDIR /web-ui

# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
 && chown -R user:user  /web-ui
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user

# All users can use /home/user as their home directory
ENV HOME=/home/user
RUN mkdir $HOME/.cache $HOME/.config \
 && chmod -R 777 $HOME

# Set up the Conda environment
ENV CONDA_AUTO_UPDATE_CONDA=false \
    PATH=$HOME/miniconda/bin:$PATH
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
 && chmod +x ~/miniconda.sh \
 && ~/miniconda.sh -b -p ~/miniconda \
 && rm ~/miniconda.sh \
 && conda clean -ya

# Create and activate Conda environment with Python 3.11
RUN conda create -y -n webui python=3.11 && \
    echo "conda activate webui" >> ~/.bashrc

# Install dependencies into Conda env
RUN /home/user/miniconda/envs/webui/bin/pip install --no-cache-dir --upgrade pip uv==0.4.17 playwright && \
    /home/user/miniconda/envs/webui/bin/pip install --no-cache-dir -r requirements.txt && \
    /home/user/miniconda/envs/webui/bin/playwright install --with-deps chromium

# Expose application port
EXPOSE 7860

# Fix ownership and permissions
RUN chown -R user:user /web-ui && chmod -R 755 /web-ui

# Use Conda environment Python explicitly
# CMD ["/home/user/miniconda/envs/webui/bin/python", "webui.py", "--ip", "0.0.0.0", "--port", "7860"]
CMD bash -c "\
    x11vnc -forever -nopw -display :0 & \
    websockify --web=/usr/share/novnc/ 7860 localhost:5900 & \
    /home/user/miniconda/envs/webui/bin/python webui.py --ip 0.0.0.0 --port 7860 \
"