mirror of
https://github.com/open-webui/open-terminal.git
synced 2026-11-25 23:00:54 -05:00
Add OPEN_TERMINAL_ALLOWED_DOMAINS env var for domain-level network restriction. Uses dnsmasq as a local DNS resolver (NXDOMAIN for non-whitelisted domains), ipset for dynamic IP tracking (dnsmasq auto-populates resolved IPs), iptables to block external DNS and non-whitelisted IPs, and capsh to permanently drop CAP_NET_ADMIN. Supports wildcards (*.github.com), live DNS, fails closed. Set to empty string to block all; omit for full access. Gracefully skips on bare metal if iptables is unavailable. Bump version 0.11.11 → 0.11.12
72 lines
2.0 KiB
Docker
72 lines
2.0 KiB
Docker
FROM python:3.12
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
# Core utilities
|
|
coreutils findutils grep sed gawk diffutils patch \
|
|
less file tree bc man-db \
|
|
# Networking
|
|
curl wget net-tools iputils-ping dnsutils netcat-openbsd socat telnet \
|
|
openssh-client rsync \
|
|
# Editors
|
|
vim nano \
|
|
# Version control
|
|
git \
|
|
# Build tools
|
|
build-essential cmake make \
|
|
# Scripting & languages
|
|
perl ruby-full lua5.4 \
|
|
# Data processing
|
|
jq xmlstarlet sqlite3 \
|
|
# Media & documents
|
|
ffmpeg pandoc imagemagick texlive-latex-base \
|
|
# Compression
|
|
zip unzip tar gzip bzip2 xz-utils zstd p7zip-full \
|
|
# System
|
|
procps htop lsof strace sysstat \
|
|
sudo tmux screen tini iptables ipset dnsmasq \
|
|
ca-certificates gnupg apt-transport-https \
|
|
# Capabilities (needed for setcap on Python binary)
|
|
libcap2-bin \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Node.js (LTS)
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
&& apt-get install -y --no-install-recommends nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Docker CLI + Compose + Buildx (mount socket at runtime for access)
|
|
RUN curl -fsSL https://get.docker.com | sh
|
|
|
|
WORKDIR /app
|
|
|
|
RUN pip install --no-cache-dir \
|
|
numpy pandas scipy scikit-learn \
|
|
matplotlib seaborn plotly \
|
|
jupyter ipython \
|
|
requests beautifulsoup4 lxml \
|
|
sqlalchemy psycopg2-binary \
|
|
pyyaml toml jsonlines \
|
|
tqdm rich \
|
|
openpyxl weasyprint \
|
|
python-docx python-pptx pypdf csvkit
|
|
|
|
COPY . .
|
|
# setcap MUST run in the same layer as the Python binary to avoid
|
|
# overlay2 copy-up corruption of libpython3.12.so ("file too short").
|
|
RUN pip install --no-cache-dir . \
|
|
&& setcap cap_setgid+ep $(readlink -f $(which python3))
|
|
|
|
RUN useradd -m -s /bin/bash user && echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
|
|
USER user
|
|
ENV SHELL=/bin/bash
|
|
ENV PATH="/home/user/.local/bin:${PATH}"
|
|
WORKDIR /home/user
|
|
|
|
EXPOSE 8000
|
|
|
|
COPY entrypoint.sh /app/entrypoint.sh
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--", "/app/entrypoint.sh"]
|
|
CMD ["run"]
|