binary1ne commited on
Commit
d9afe4b
·
verified ·
1 Parent(s): 5acd02d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -23
Dockerfile CHANGED
@@ -1,11 +1,11 @@
1
  FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  TZ=Asia/Kolkata \
5
- PYTHONUNBUFFERED=1
6
 
7
-
8
- # Install required OS packages (minimal set, pinned where possible)
9
  RUN apt-get update && \
10
  apt-get install -y --no-install-recommends \
11
  curl \
@@ -21,7 +21,7 @@ RUN apt-get update && \
21
  libsndfile-dev \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
- # Set up the Conda environment
25
  ENV CONDA_AUTO_UPDATE_CONDA=false \
26
  PATH=$HOME/miniconda/bin:$PATH
27
 
@@ -30,36 +30,32 @@ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39
30
  && ~/miniconda.sh -b -p ~/miniconda \
31
  && rm ~/miniconda.sh \
32
  && conda clean -ya
33
-
34
  # Clone repository
35
  RUN git clone https://github.com/browser-use/web-ui.git /web-ui
36
  WORKDIR /web-ui
37
-
 
38
  RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
39
  && chown -R user:user /web-ui
40
-
41
  RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
42
-
43
  USER user
44
 
45
- # Install uv globally (avoids pip bootstrap issues)
46
- RUN pip3 install --no-cache-dir uv==0.4.17
 
47
 
48
- # Create virtual environment in /opt (exec-mounted path)
49
- RUN uv venv --python 3.11 && \
50
- chmod -R a+rx /web-ui/.venv && chmod -R a+r /web-ui/.venv
51
-
52
- # Install dependencies inside venv
53
- RUN .venv/bin/python3 -m ensurepip && \
54
- .venv/bin/pip3 install --no-cache-dir --upgrade pip uv==0.4.17 playwright && \
55
- .venv/bin/pip3 install --no-cache-dir -r requirements.txt && \
56
- .venv/bin/playwright install --with-deps chromium
57
 
58
  # Expose application port
59
  EXPOSE 7860
60
 
61
- # Set ownership and permissions for the app directory
62
- RUN chown -R admin:admin /web-ui && chmod -R 777 /web-ui
 
 
 
63
 
64
- # Explicitly use venv Python
65
- CMD [".venv/bin/python3", "webui.py", "--ip", "0.0.0.0", "--port", "7860"]
 
1
  FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
2
 
3
+ # Environment settings
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  TZ=Asia/Kolkata \
6
+ PYTHONUNBUFFERED=1
7
 
8
+ # Install required OS packages (minimal set)
 
9
  RUN apt-get update && \
10
  apt-get install -y --no-install-recommends \
11
  curl \
 
21
  libsndfile-dev \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
+ # Install Miniconda
25
  ENV CONDA_AUTO_UPDATE_CONDA=false \
26
  PATH=$HOME/miniconda/bin:$PATH
27
 
 
30
  && ~/miniconda.sh -b -p ~/miniconda \
31
  && rm ~/miniconda.sh \
32
  && conda clean -ya
33
+
34
  # Clone repository
35
  RUN git clone https://github.com/browser-use/web-ui.git /web-ui
36
  WORKDIR /web-ui
37
+
38
+ # Create non-root user
39
  RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
40
  && chown -R user:user /web-ui
 
41
  RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
 
42
  USER user
43
 
44
+ # Create and activate Conda environment with Python 3.11
45
+ RUN conda create -y -n webui python=3.11 && \
46
+ echo "conda activate webui" >> ~/.bashrc
47
 
48
+ # Install dependencies into Conda env
49
+ RUN /home/user/miniconda/envs/webui/bin/pip install --no-cache-dir --upgrade pip uv==0.4.17 playwright && \
50
+ /home/user/miniconda/envs/webui/bin/pip install --no-cache-dir -r requirements.txt && \
51
+ /home/user/miniconda/envs/webui/bin/playwright install --with-deps chromium
 
 
 
 
 
52
 
53
  # Expose application port
54
  EXPOSE 7860
55
 
56
+ # Fix ownership and permissions
57
+ RUN chown -R user:user /web-ui && chmod -R 755 /web-ui
58
+
59
+ # Use Conda environment Python explicitly
60
+ CMD ["/home/user/miniconda/envs/webui/bin/python", "webui.py", "--ip", "0.0.0.0", "--port", "7860"]
61