File size: 3,534 Bytes
6b37fb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
FROM rocker/shiny:latest

# Set working directory inside container
WORKDIR /code

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    libcurl4-openssl-dev \
    libssl-dev \
    libxml2-dev \
    libnlopt-dev \
    libicu-dev \
    libgdal-dev \
    libgeos-dev \
    libproj-dev \
    libv8-dev \
    libnode-dev \
    libglpk-dev \
    libglpk40 \
    libgmp-dev \
    zlib1g-dev \
    libbz2-dev \
    libgit2-dev \
    libudunits2-dev \
    libgsl-dev \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# ---- IMPORTANT ----
# Every install step below is written WITHOUT the old
# "> log.log 2>&1 || cat log.log" pattern.
# That pattern always returns exit 0 (because `cat` succeeds even
# when the install failed), so Docker thought the build succeeded
# even when a package silently failed to install. Then app.R's
# library() calls would crash the app the instant it tried to start -
# which looks exactly like "Space won't start" with no clear cause.
# Now, if ANY package fails, the build fails immediately and you see
# exactly which package and why in the HF build log.

RUN install2.r --error --skipmissing --repo https://cloud.r-project.org \
    devtools \
    remotes

RUN install2.r --error --skipmissing --repo https://cloud.r-project.org \
    htmltools \
    htmlwidgets \
    jsonlite \
    crosstalk \
    magrittr \
    promises

RUN install2.r --error --skipmissing --repo https://cloud.r-project.org \
    nloptr \
    lme4 \
    emmeans \
    readxl \
    plotly \
    shinyjs \
    shinyWidgets \
    DT \
    RColorBrewer \
    ggrepel \
    openxlsx \
    randomForest \
    caret \
    writexl \
    viridis \
    tidyverse \
    shinythemes \
    shinyBS \
    data.table \
    dplyr \
    tidyr \
    qtlDesign

RUN install2.r --error --skipmissing --repo https://cloud.r-project.org \
    igraph \
    vcfR \
    dbscan \
    factoextra \
    cluster

RUN install2.r --error --repo https://cloud.r-project.org \
    qtl

RUN install2.r --error --repo https://cloud.r-project.org \
    ggplot2 \
    gridExtra \
    locfit

# Install QTLseqr from GitHub - fails the build immediately if it doesn't install
RUN R -e "options(timeout = 1200); \
          remotes::install_github('bmansfeld/QTLseqr'); \
          if (!requireNamespace('QTLseqr', quietly = TRUE)) { \
            stop('QTLseqr installation failed') \
          }"

# Install qtlTools from GitHub - fails the build immediately if it doesn't install
RUN R -e "options(timeout = 1200); \
          remotes::install_github('jtlovell/qtlTools'); \
          if (!requireNamespace('qtlTools', quietly = TRUE)) { \
            stop('qtlTools installation failed') \
          }"

# Final sanity check - confirms every package app.R actually loads is present
RUN R -e " \
  pkgs <- c('shiny','shinyjs','shinythemes','shinyBS','plotly','DT', \
            'QTLseqr','data.table','dplyr','tidyr','vcfR','ggplot2', \
            'dbscan','factoextra','cluster','viridis'); \
  missing <- pkgs[!sapply(pkgs, requireNamespace, quietly = TRUE)]; \
  if (length(missing) > 0) { \
    stop('Missing required packages: ', paste(missing, collapse=', ')) \
  } else { \
    cat('All required packages installed OK\n') \
  }"

# Create www directory and health file
RUN mkdir -p /code/www && echo "OK" > /code/www/health

# Copy app code
COPY app.R /code/

# Expose the port Shiny will run on
EXPOSE 7860

# Run the app
CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]