hug / Dockerfile
misukisu's picture
Update Dockerfile
7a5c043 verified
Raw
History Blame Contribute Delete
1.15 kB
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"]