File size: 1,559 Bytes
cf5d39c
 
 
 
3f363fe
cf5d39c
 
 
 
 
 
2b84330
 
cf5d39c
 
 
 
 
 
 
 
 
 
2b84330
 
 
59dca3d
 
f438942
5bfd506
 
 
 
 
 
 
cf5d39c
 
 
 
 
 
 
 
2b84330
cf5d39c
2b84330
8ed6d41
 
2b84330
cf5d39c
 
 
 
2b84330
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
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)"]