File size: 3,837 Bytes
759f397
914865e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a6d702
914865e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM ubuntu:latest

LABEL description="Code Server + Stealth Browser Β· HF Spaces"

ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/root
ENV SHELL=/bin/bash
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV CS_EXTENSIONS_DIR=/root/.local/share/code-server/extensions

# ── Base system ────────────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl wget git git-lfs \
    vim nano htop tree watch \
    python3 python3-pip python3-venv python3-dev \
    build-essential pkg-config cmake \
    sudo locales jq unzip zip tar gzip xz-utils bzip2 \
    ca-certificates gnupg openssh-client ripgrep procps \
    nginx \
    && locale-gen en_US.UTF-8 \
    && rm -rf /var/lib/apt/lists/*

# ── Node.js 20 LTS ─────────────────────────────────────────────────────────
RUN curl -fsSL "https://nodejs.org/dist/v20.19.0/node-v20.19.0-linux-x64.tar.xz" \
      -o /tmp/node.tar.xz \
    && tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
    && rm /tmp/node.tar.xz \
    && npm install -g yarn pnpm

# ── GitHub CLI ─────────────────────────────────────────────────────────────
# ── code-server ────────────────────────────────────────────────────────────
RUN curl -fsSL https://code-server.dev/install.sh | sh \
    && rm -rf /tmp/code-server*

# ── Python + Playwright + stealth ─────────────────────────────────────────
RUN pip3 install --no-cache-dir \
    fastapi "uvicorn[standard]" \
    playwright "playwright-stealth==1.0.6" \
    ipykernel requests httpx \
    numpy pandas black isort pylint \
    huggingface_hub

# ── Playwright Chromium + system deps ─────────────────────────────────────
RUN playwright install chromium --with-deps

# ── VS Code extensions ─────────────────────────────────────────────────────
RUN mkdir -p "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension ms-python.python            --extensions-dir "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension ms-toolsai.jupyter          --extensions-dir "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension esbenp.prettier-vscode      --extensions-dir "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension eamodio.gitlens             --extensions-dir "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension PKief.material-icon-theme   --extensions-dir "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension formulahendry.code-runner   --extensions-dir "$CS_EXTENSIONS_DIR" \
    && code-server --install-extension christian-kohler.path-intellisense --extensions-dir "$CS_EXTENSIONS_DIR"

# ── App files ──────────────────────────────────────────────────────────────
RUN mkdir -p /app/static
COPY browser_server.py    /app/browser_server.py
COPY static/browser.html  /app/static/browser.html
COPY nginx.conf           /etc/nginx/nginx.conf
COPY start.sh             /start.sh
RUN chmod +x /start.sh

WORKDIR /root
EXPOSE 7860
CMD ["/start.sh"]