Spaces:
Paused
Paused
Download Dockerfile from GopiBNA/ComparerToolV2: direct link, hf CLI and curl.
- Browser
- Download file 2.82 kB
-
https://huggingface.co/spaces/GopiBNA/ComparerToolV2/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/GopiBNA/ComparerToolV2/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/GopiBNA/ComparerToolV2/resolve/main/Dockerfile
2.82 kB
| # BNA Comparator Web v2 — Live-browser edition | |
| # Hugging Face Spaces Docker image with the full live-browser stack: | |
| # Xvfb + x11vnc + websockify + noVNC behind Caddy. The Tier-1 | |
| # "Sign in to BNAmericas — live" flow runs a headed Chromium on the | |
| # Xvfb display and streams it to the researcher's tab via noVNC. | |
| FROM python:3.12-slim | |
| # --- 1. System packages (single apt-get pass) ------------------------ | |
| # Chromium runtime libs + the live-browser stack. novnc, websockify, | |
| # x11vnc, xvfb are all in Debian Trixie main. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates curl wget fonts-liberation \ | |
| libglib2.0-0 libnss3 libnspr4 libdbus-1-3 \ | |
| libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 \ | |
| libatspi2.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 \ | |
| libxfixes3 libxrandr2 libgbm1 libxss1 \ | |
| libpango-1.0-0 libpangocairo-1.0-0 libcairo2 libxshmfence1 \ | |
| xvfb x11vnc novnc websockify python3-websockify net-tools procps \ | |
| && (apt-get install -y --no-install-recommends libasound2 \ | |
| || apt-get install -y --no-install-recommends libasound2t64) \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # --- 2. Caddy (downloaded binary — way more reliable than apt repo) -- | |
| ARG CADDY_VERSION=2.8.4 | |
| RUN curl -fsSL \ | |
| "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" \ | |
| -o /tmp/caddy.tgz \ | |
| && tar -xzf /tmp/caddy.tgz -C /usr/local/bin caddy \ | |
| && chmod +x /usr/local/bin/caddy \ | |
| && rm /tmp/caddy.tgz \ | |
| && caddy version | |
| # --- 3. Pre-create X11 socket dir + non-root user -------------------- | |
| RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| # --- 4. Python deps + Playwright Chromium ---------------------------- | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt \ | |
| && python -m playwright install chromium | |
| # --- 5. App source --------------------------------------------------- | |
| COPY --chown=user . . | |
| # Make sure the entrypoint is executable (handles line-ending issues | |
| # on Windows-edited files too). | |
| USER root | |
| RUN sed -i 's/\r$//' /home/user/app/start.sh \ | |
| && chmod +x /home/user/app/start.sh | |
| USER user | |
| # --- 6. Live-browser config ----------------------------------------- | |
| # Xvfb runs on :99; x11vnc serves it on 5900; websockify bridges 5900 | |
| # to a WebSocket on 6080; Caddy proxies the WebSocket under | |
| # /websockify and the noVNC static HTML under /novnc. | |
| ENV DISPLAY=:99 \ | |
| LIVE_VNC_PORT=5900 \ | |
| LIVE_WS_PORT=6080 \ | |
| STREAMLIT_INTERNAL_PORT=8501 \ | |
| STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| EXPOSE 7860 | |
| CMD ["/home/user/app/start.sh"] | |