binary1ne commited on
Commit
69210ea
·
verified ·
1 Parent(s): 1727112

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -10
Dockerfile CHANGED
@@ -5,6 +5,9 @@ ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONUNBUFFERED=1 \
6
  PATH="/opt/venv/bin:$PATH"
7
 
 
 
 
8
  # Install required OS packages (minimal set, pinned where possible)
9
  RUN apt-get update && \
10
  apt-get install -y --no-install-recommends \
@@ -24,27 +27,30 @@ RUN apt-get update && \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
  # Clone repository
27
- RUN git clone --depth=1 https://github.com/browser-use/web-ui.git /web-ui
28
  WORKDIR /web-ui
29
 
30
  # Install uv globally (avoids pip bootstrap issues)
31
  RUN pip3 install --no-cache-dir uv==0.4.17
32
 
33
  # Create virtual environment in /opt (exec-mounted path)
34
- RUN uv venv /opt/venv --python 3.11 && \
35
- chmod -R a+rx /opt/venv && chmod -R a+r /opt/venv
36
 
37
  # Install dependencies inside venv
38
- RUN /opt/venv/bin/python -m ensurepip --upgrade && \
39
- /opt/venv/bin/pip install --no-cache-dir --upgrade pip uv==0.4.17 playwright && \
40
- /opt/venv/bin/pip install --no-cache-dir -r requirements.txt && \
41
- /opt/venv/bin/playwright install --with-deps chromium
42
 
43
  # Expose application port
44
  EXPOSE 7860
45
 
46
- # Keep root for NVIDIA entrypoint compatibility
47
- USER root
 
 
 
 
48
 
49
  # Explicitly use venv Python
50
- CMD ["/opt/venv/bin/python", "webui.py", "--ip", "0.0.0.0", "--port", "7860"]
 
5
  PYTHONUNBUFFERED=1 \
6
  PATH="/opt/venv/bin:$PATH"
7
 
8
+ # Create and use a non-root user
9
+ RUN useradd -ms /bin/bash admin
10
+
11
  # Install required OS packages (minimal set, pinned where possible)
12
  RUN apt-get update && \
13
  apt-get install -y --no-install-recommends \
 
27
  && rm -rf /var/lib/apt/lists/*
28
 
29
  # Clone repository
30
+ RUN git clone https://github.com/browser-use/web-ui.git /web-ui
31
  WORKDIR /web-ui
32
 
33
  # Install uv globally (avoids pip bootstrap issues)
34
  RUN pip3 install --no-cache-dir uv==0.4.17
35
 
36
  # Create virtual environment in /opt (exec-mounted path)
37
+ RUN uv venv --python 3.11 && \
38
+ chmod -R a+rx /web-ui/.venv && chmod -R a+r /web-ui/.venv
39
 
40
  # Install dependencies inside venv
41
+ RUN .venv/bin/pip install --no-cache-dir --upgrade pip uv==0.4.17 playwright && \
42
+ .venv/bin/pip install --no-cache-dir -r requirements.txt && \
43
+ .venv/bin/playwright install --with-deps chromium
 
44
 
45
  # Expose application port
46
  EXPOSE 7860
47
 
48
+ # Set ownership and permissions for the app directory
49
+ RUN chown -R admin:admin /web-ui && chmod -R 777 /web-ui
50
+
51
+
52
+ # Switch to the non-root user for better security
53
+ USER admin
54
 
55
  # Explicitly use venv Python
56
+ CMD [".venv/bin/python3", "webui.py", "--ip", "0.0.0.0", "--port", "7860"]