File size: 1,150 Bytes
5541f92
 
7a5c043
5541f92
 
 
 
4f48d6e
5541f92
 
 
 
 
4f48d6e
 
 
 
 
5541f92
7a5c043
 
5541f92
 
c342463
5541f92
 
 
7a5c043
 
 
5541f92
 
 
7a5c043
5541f92
 
 
 
7a5c043
5541f92
 
c342463
5541f92
 
 
 
7a5c043
5541f92
 
 
 
 
 
 
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
FROM python:3.10-slim

# Install system utilities, network tools, and Chromium with its driver
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
    nmap \
    curl \
    wget \
    git \
    dnsutils \
    whois \
    netcat-openbsd \
    tshark \
    iputils-ping \
    traceroute \
    openssl \
    jq \
    socat \
    libcap2-bin \
    chromium \
    chromium-driver \
    && rm -rf /var/lib/apt/lists/*

# Set up non-root user (Hugging Face default UID 1000)
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1 \
    CHROME_BIN=/usr/bin/chromium \
    CHROMEDRIVER_PATH=/usr/bin/chromedriver

WORKDIR /app

# Set permissions for application directory
RUN chown -R user:user /app

USER user

# Install Python dependencies including Selenium
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir \
    gradio>=4.44.0 \
    openai>=1.20.0 \
    pydantic>=2.5.0 \
    httpx>=0.27.0 \
    beautifulsoup4>=4.12.0 \
    selenium>=4.18.0 \
    python-multipart>=0.0.9

COPY --chown=user:user . /app

EXPOSE 7860

CMD ["python", "app.py"]