suna/backend/sandbox/docker/Dockerfile

128 lines
2.9 KiB
Docker
Raw Normal View History

2025-04-09 01:25:53 +08:00
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
netcat-traditional \
gnupg \
curl \
unzip \
2025-04-12 07:22:01 +08:00
zip \
2025-04-09 01:25:53 +08:00
xvfb \
libgconf-2-4 \
libxss1 \
libnss3 \
libnspr4 \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
xdg-utils \
fonts-liberation \
dbus \
xauth \
xvfb \
x11vnc \
tigervnc-tools \
supervisor \
net-tools \
procps \
git \
python3-numpy \
fontconfig \
fonts-dejavu \
fonts-dejavu-core \
fonts-dejavu-extra \
2025-04-12 07:22:01 +08:00
tmux \
2025-04-11 23:56:26 +08:00
# PDF Processing Tools
poppler-utils \
2025-04-12 09:54:05 +08:00
wkhtmltopdf \
2025-04-11 23:56:26 +08:00
# Document Processing Tools
antiword \
unrtf \
catdoc \
# Text Processing Tools
grep \
gawk \
sed \
# File Analysis Tools
file \
# Data Processing Tools
jq \
csvkit \
xmlstarlet \
# Additional Utilities
less \
vim \
2025-04-12 07:22:01 +08:00
tree \
rsync \
lsof \
iputils-ping \
dnsutils \
2025-04-13 05:40:01 +08:00
sudo \
2025-04-09 01:25:53 +08:00
&& rm -rf /var/lib/apt/lists/*
2025-04-13 05:40:01 +08:00
# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest
# Install Cloudflare Wrangler CLI globally
RUN npm install -g wrangler
2025-04-09 01:25:53 +08:00
# Install noVNC
RUN git clone https://github.com/novnc/noVNC.git /opt/novnc \
&& git clone https://github.com/novnc/websockify /opt/novnc/utils/websockify \
&& ln -s /opt/novnc/vnc.html /opt/novnc/index.html
# Set platform for ARM64 compatibility
ARG TARGETPLATFORM=linux/amd64
# Set up working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
2025-04-13 05:40:01 +08:00
# Copy server script
2025-04-14 21:06:02 +08:00
COPY . /app
2025-04-13 05:40:01 +08:00
COPY server.py /app/server.py
2025-04-14 21:06:02 +08:00
COPY browser_api.py /app/browser_api.py
2025-04-13 05:40:01 +08:00
2025-04-09 01:25:53 +08:00
# Install Playwright and browsers with system dependencies
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
2025-04-13 05:40:01 +08:00
# Install Playwright package first
RUN pip install playwright
# Then install dependencies and browsers
2025-04-09 01:25:53 +08:00
RUN playwright install-deps
2025-04-13 05:40:01 +08:00
RUN playwright install chromium
# Verify installation
RUN python -c "from playwright.sync_api import sync_playwright; print('Playwright installation verified')"
2025-04-09 01:25:53 +08:00
# Set environment variables
ENV PYTHONUNBUFFERED=1
2025-05-18 12:15:09 +08:00
ENV CHROME_PATH=/ms-playwright/chromium-*/chrome-linux/chrome
2025-04-09 01:25:53 +08:00
ENV ANONYMIZED_TELEMETRY=false
ENV DISPLAY=:99
2025-05-18 12:23:01 +08:00
ENV RESOLUTION=1920x1080x24
2025-04-09 01:25:53 +08:00
ENV VNC_PASSWORD=vncpassword
ENV CHROME_PERSISTENT_SESSION=true
2025-05-18 12:23:01 +08:00
ENV RESOLUTION_WIDTH=1920
ENV RESOLUTION_HEIGHT=1080
2025-04-09 01:25:53 +08:00
# Set up supervisor configuration
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
2025-04-22 01:27:12 +08:00
EXPOSE 7788 6080 5901 8000 8080
2025-04-09 01:25:53 +08:00
2025-05-10 14:28:40 +08:00
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]