vscode / Dockerfile
abcd118q's picture
Update Dockerfile
8a6d702 verified
FROM ubuntu:22.04
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"]