softwareDevelopment commited on
Commit
1d61b28
Β·
verified Β·
1 Parent(s): fe1cd4d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +76 -50
Dockerfile CHANGED
@@ -26,55 +26,81 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
26
  && apt-get clean \
27
  && rm -rf /var/lib/apt/lists/*
28
 
29
- # ── Install R packages ────────────────────────────────────────
30
- # Using pak for faster, reliable installs with dependency resolution
31
- RUN R -e "install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable/')"
32
-
33
- RUN R -e "pak::pkg_install(c( \
34
- 'shiny', \
35
- 'shinyWidgets', \
36
- 'shinyjs', \
37
- 'shinycssloaders', \
38
- 'qtl', \
39
- 'ggplot2', \
40
- 'plotly', \
41
- 'DT', \
42
- 'dplyr', \
43
- 'tidyr', \
44
- 'viridis', \
45
- 'RColorBrewer', \
46
- 'reshape2', \
47
- 'scales', \
48
- 'circlize' \
49
- ), ask = FALSE)"
50
-
51
- # ── Create non-root user (uid 1000) required by HF Spaces ────
52
- # Must be created BEFORE chown calls that reference it.
53
- RUN useradd -m -u 1000 -s /bin/bash user
54
-
55
- # ── App directory ─────────────────────────────────────────────
56
- RUN mkdir -p /home/user/app
57
- WORKDIR /home/user/app
58
- COPY app.R /home/user/app/app.R
59
-
60
- # ── Log directory ─────────────────────────────────────────────
61
- RUN mkdir -p /var/log/shiny-server \
62
- && chown -R user:user /var/log/shiny-server \
63
- && chown -R user:user /home/user/app
64
-
65
- # ── Shiny Server config ───────────────────────────────────────
66
- # IMPORTANT: run_as must match the USER we switch to (user, uid 1000).
67
- # Using "run_as shiny;" while the process runs as uid 1000 ('user') causes
68
- # shiny-server to error because it cannot impersonate the 'shiny' account.
69
- RUN mkdir -p /etc/shiny-server && \
70
- printf 'run_as user;\n\nserver {\n listen 7860;\n\n location / {\n site_dir /home/user/app;\n log_dir /var/log/shiny-server;\n directory_index off;\n app_idle_timeout 0;\n app_init_timeout 300;\n sanitize_errors off;\n }\n}\n' \
71
- > /etc/shiny-server/shiny-server.conf
72
-
73
- # ── Switch to non-root user ───────────────────────────────────
74
- USER user
75
-
76
- # ── Expose HF Spaces port ─────────────────────────────────────
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  EXPOSE 7860
78
 
79
- # ── Launch ────────────────────────────────────────────────────
80
- CMD ["/usr/bin/shiny-server"]
 
26
  && apt-get clean \
27
  && rm -rf /var/lib/apt/lists/*
28
 
29
+
30
+
31
+
32
+
33
+ # Install additional system dependencies including libglpk for igraph
34
+ RUN apt-get update && apt-get install -y \
35
+ libcurl4-openssl-dev \
36
+ libssl-dev \
37
+ libxml2-dev \
38
+ libnlopt-dev \
39
+ libicu-dev \
40
+ libgdal-dev \
41
+ libgeos-dev \
42
+ libproj-dev \
43
+ libv8-dev \
44
+ libnode-dev \
45
+ libglpk-dev \
46
+ libglpk40 \
47
+ zlib1g-dev \
48
+ libbz2-dev \
49
+ liblzma-dev \
50
+ && rm -rf /var/lib/apt/lists/*
51
+
52
+ # Install DT dependencies first
53
+ RUN install2.r --error \
54
+ htmltools \
55
+ htmlwidgets \
56
+ jsonlite \
57
+ crosstalk \
58
+ magrittr \
59
+ promises
60
+
61
+ # Then install the main packages (excluding QTLseqr and vcfR for now)
62
+ RUN install2.r --error \
63
+ nloptr \
64
+ lme4 \
65
+ emmeans \
66
+ readxl \
67
+ plotly \
68
+ shinyjs \
69
+ shinyWidgets \
70
+ DT \
71
+ RColorBrewer \
72
+ ggrepel \
73
+ openxlsx
74
+
75
+ # Install tidyverse and igraph
76
+ RUN install2.r --error tidyverse igraph
77
+
78
+ # Install data.table separately
79
+ RUN install2.r --error data.table
80
+
81
+ # Install BiocManager
82
+ RUN R -e "install.packages('BiocManager', repos='https://cloud.r-project.org/')"
83
+
84
+ # Install Bioconductor dependencies
85
+ RUN R -e "BiocManager::install(c('GenomicRanges', 'IRanges', 'S4Vectors', 'Biostrings', 'Rsamtools', 'GenomeInfoDb'), ask=FALSE, update=FALSE)"
86
+
87
+ # Install vcfR package
88
+ RUN install2.r --error vcfR
89
+
90
+ # Install remotes for GitHub installations
91
+ RUN install2.r --error remotes
92
+
93
+ # Install QTLseqr from GitHub
94
+ RUN R -e "remotes::install_github('bmansfeld/QTLseqr', upgrade='never', dependencies=FALSE)"
95
+
96
+ # Create www directory and health file directly
97
+ RUN mkdir -p /code/www && echo "OK" > /code/www/health
98
+
99
+ # Copy app code
100
+ COPY app.R /code/
101
+
102
+ # Expose the port Shiny will run on
103
  EXPOSE 7860
104
 
105
+ # Run the app with corrected host address
106
+ CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]