bhanug2026's picture
Upload 10 files
6493351 verified
# ╔══════════════════════════════════════════════════════════════════╗
# β•‘ BubbleBusters β€” Hugging Face Space Dockerfile β•‘
# β•‘ Uses rocker/r-ver as base β€” R is pre-installed, no apt needed β•‘
# β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
# rocker/r-ver:4.3 = Debian Bookworm + R 4.3 pre-installed
FROM rocker/r-ver:4.3
# ── 1. System libraries ──────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libzmq3-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# ── 2. Python packages FIRST β€” jupyter must exist before IRkernel ───
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --no-cache-dir --upgrade pip \
&& pip3 install --no-cache-dir -r /tmp/requirements.txt
# ── 3. R packages via Posit Package Manager (pre-built binaries) ────
RUN Rscript -e "\
options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest')); \
install.packages(c( \
'vctrs', 'rlang', 'pillar', \
'readr', 'dplyr', 'tidyr', 'lubridate', \
'ggplot2', 'MASS', 'zoo', 'jsonlite', 'scales' \
), Ncpus = 2)"
# ── 4. IRkernel β€” jupyter is now installed so installspec works ──────
RUN Rscript -e "\
options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest')); \
install.packages('IRkernel')" \
&& Rscript -e "IRkernel::installspec(user = FALSE)"
# ── 5. Non-root user (Hugging Face Spaces requirement) ──────────────
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
# ── 6. App source ───────────────────────────────────────────────────
COPY --chown=user . .
# ── 7. Gradio networking ─────────────────────────────────────────────
ENV GRADIO_SERVER_NAME="0.0.0.0" \
GRADIO_SERVER_PORT=7860
EXPOSE 7860
CMD ["python3", "app.py"]