FROM rocker/r2u:24.04 # ---- System deps: Python for reticulate -> huggingface_hub ---- RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip python3-dev \ && rm -rf /var/lib/apt/lists/* # ---- Python lib used for the HF upload (called through reticulate) ---- RUN pip3 install --no-cache-dir --break-system-packages huggingface_hub # ---- R packages (r2u serves these as apt binaries) ---- # tidymodels brings recipes/dplyr/tidyr/workflows/parsnip, so those aren't listed separately. # kknn is the engine behind the xwOBA model - needed at predict time even though it's never library()'d. RUN install2.r --error --skipinstalled \ shiny \ arrow \ httr \ jsonlite \ readr \ DT \ reticulate \ xgboost \ stringr \ bundle \ tidymodels \ kknn \ base64enc \ bslib \ glue \ patchwork \ gt \ gtExtras \ purrr \ scales \ knitr \ htmltools # ---- Point reticulate at the system Python where huggingface_hub lives ---- ENV RETICULATE_PYTHON=/usr/bin/python3 # ---- Writable cache/home (HF Spaces filesystem is read-only except /tmp) ---- ENV HOME=/tmp ENV HF_HOME=/tmp/hf # ---- App files (flat structure, all in /app) ---- # Models + run values are downloaded from CleanDataObjects at startup, so they are NOT copied here. WORKDIR /app COPY app.R /app/app.R COPY HHLogo.png /app/HHLogo.png # ---- HF Spaces expects the app on port 7860 ---- EXPOSE 7860 CMD ["R", "-e", "shiny::runApp('/app', host='0.0.0.0', port=7860)"]