File size: 4,227 Bytes
d7d2934
8a43ca9
d9afe4b
d7d2934
 
bdd065a
 
 
 
1727112
d9afe4b
cdfc8b3
 
1727112
cdfc8b3
0e91470
 
1727112
0e91470
cdfc8b3
0e91470
1727112
 
 
 
cdfc8b3
c273690
0e91470
c273690
bdd065a
b03d8b5
 
cdfc8b3
d9afe4b
63508d6
 
 
 
 
 
 
 
 
 
 
f839d58
88e07c5
 
63508d6
 
 
 
 
 
 
88e07c5
f839d58
 
 
63508d6
 
f839d58
63508d6
a977f39
1727112
b3e13bc
 
049f904
d9afe4b
1b78bbc
299c065
d470fdb
 
b6b7b62
 
 
bdd065a
fa71592
bdd065a
bf86364
 
8785b16
 
a1af082
5acd02d
8e36933
5acd02d
 
3da3e4c
cdfc8b3
 
1e0b3bc
468705f
cdfc8b3
ba5fd54
ff79964
cdfc8b3
 
 
d470fdb
cdfc8b3
 
 
 
 
 
d9afe4b
 
 
2971656
cf40818
f839d58
0e91470
10e6a57
 
 
 
dad6e41
fe10713
 
fcec103
fe10713
10e6a57
fe10713
d9afe4b
468705f
d9afe4b
 
3da3e4c
1727112
78be0d3
1727112
d9afe4b
 
 
 
c273690
d470fdb
bdd065a
7e60bba
0e91470
 
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
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04

# Environment settings
ENV DEBIAN_FRONTEND=noninteractive \
    TZ=Asia/Kolkata \
    PYTHONUNBUFFERED=1 \
    RESOLUTION=1280x720x24 \
    VNC_PASSWORD=password


# 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 \
    ca-certificates \
    sudo \
    git git-lfs \
    curl wget net-tools \
    procps \
    zip unzip \
    htop \
    vim nano \
    bzip2 \
    libx11-6 \
    build-essential \
    libsndfile-dev \
    software-properties-common \
    xfce4 xfce4-goodies \
    x11vnc xvfb \
    novnc websockify \
    supervisor \
    tigervnc-standalone-server \
    tigervnc-common \
 && rm -rf /var/lib/apt/lists/*

# # Proper noVNC setup X11 and logs (fixed)
# RUN mkdir -p /opt/novnc && \
#     ln -s /usr/share/novnc/* /opt/novnc/ && \
#     ln -s /usr/share/novnc/utils /opt/novnc/utils &&\
#     mkdir -p /var/log/x11vnc && \
#     touch /var/log/x11vnc.log && \
#     chmod 755 /var/log/x11vnc && \
#     chmod 644 /var/log/x11vnc.log && \
#     chmod -R 755 /opt/novnc && \
#     chmod +x /opt/novnc/utils/* 
    
# Proper noVNC setup X11 and logs (fixed)
RUN mkdir -p /opt/novnc && \
    ln -s /usr/share/novnc/* /opt/novnc/ && \
    ln -s /usr/share/novnc/utils /opt/novnc/utils && \
    \
    # Fix X11 socket dir
    mkdir -p /tmp/.X11-unix && \
    chmod 1777 /tmp/.X11-unix && \
    \
    # Fix logs for x11vnc
    mkdir -p /var/log/x11vnc && \
    touch /var/log/x11vnc.log && \
    chmod 755 /var/log/x11vnc && \
    chmod 644 /var/log/x11vnc.log && \
    \
    # Fix novnc perms
    chmod -R 755 /opt/novnc && \
    chmod +x /opt/novnc/utils/*

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

WORKDIR /web-ui

RUN pwd && ls -la /web-ui

COPY webui_with_vnc.py start.sh /web-ui/ 

# Create supervisor directory first
RUN mkdir -p /etc/supervisor/conf.d

# Copy your custom supervisor config
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# COPY /web-ui/src/utils/config.py /web-ui/src/utils/config_1.py
RUN ls -la /web-ui/src/utils/
COPY config.py  /web-ui/src/utils/config.py

# 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 $HOME/.vnc\
   && chmod -R 777 $HOME

RUN touch ~/.vnc/x11vnc.log 

# 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

# Fix permissions for X11 and logs (fixed)
RUN chown user:user /var/log/x11vnc /var/log/x11vnc.log || true  
       
# Set up supervisor and permissions
RUN mkdir -p /etc/supervisor/conf.d && \
    mkdir -p /var/log/supervisor && \
    mkdir -p /home/user/.vnc && \
    chown -R user:user /home/user 
    
# Final permission fixes
RUN chmod -R 755 /web-ui && \
    chown -R user:user /var/log/supervisor || true  

  
# Install dependencies into Conda env
RUN /home/user/miniconda/envs/webui/bin/pip install --no-cache-dir --upgrade pip uv==0.4.17 playwright gradio python-dotenv && \
    /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"]

# Start supervisor
# CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

CMD ["/web-ui/start.sh"]