International Rice Research Institute commited on
Commit
999dcc9
·
verified ·
1 Parent(s): 3c8c922

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +46 -31
Dockerfile CHANGED
@@ -3,7 +3,7 @@ FROM rocker/shiny:latest
3
  # Set working directory inside container
4
  WORKDIR /code
5
 
6
- # Install additional system dependencies including libglpk for igraph
7
  RUN apt-get update && apt-get install -y \
8
  libcurl4-openssl-dev \
9
  libssl-dev \
@@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y \
21
  zlib1g-dev \
22
  libbz2-dev \
23
  libgit2-dev \
 
 
24
  && apt-get clean \
25
  && rm -rf /var/lib/apt/lists/*
26
 
@@ -40,7 +42,7 @@ RUN install2.r --error --repo https://cloud.r-project.org \
40
  promises \
41
  > install_dt.log 2>&1 || cat install_dt.log
42
 
43
- # Install main packages, including qtlDesign
44
  RUN install2.r --error --repo https://cloud.r-project.org \
45
  nloptr \
46
  lme4 \
@@ -80,43 +82,56 @@ RUN install2.r --error --repo https://cloud.r-project.org \
80
  qtl \
81
  > install_qtl.log 2>&1 || cat install_qtl.log
82
 
83
- # Install system dependencies for qtlTools
84
- RUN apt-get update && apt-get install -y \
85
- libudunits2-dev \
86
- libgsl-dev \
87
- && apt-get clean \
88
- && rm -rf /var/lib/apt/lists/*
89
-
90
- # Try alternative installation methods for problematic packages
91
- # First attempt: Install qtlTools with specific version and skip dependencies if needed
92
  RUN R -e "options(timeout = 600); \
93
- tryCatch({ \
94
- remotes::install_github('jtlovell/qtlTools', ref='main', dependencies=TRUE, upgrade='always') \
95
- }, error = function(e) { \
96
- message('First attempt failed: ', e$message); \
97
  tryCatch({ \
98
- remotes::install_github('jtlovell/qtlTools', ref='main', dependencies=FALSE, upgrade='never') \
99
  }, error = function(e) { \
100
- message('Second attempt failed: ', e$message); \
101
- # Install from CRAN if available or skip if not critical \
102
- install.packages('qtlTools', repos='https://cloud.r-project.org') \
 
 
 
 
 
 
 
103
  }) \
104
- })" > install_qtlTools.log 2>&1 && cat install_qtlTools.log
105
 
106
- # Install QTLseqr with similar error handling
107
  RUN R -e "options(timeout = 600); \
108
- tryCatch({ \
109
- remotes::install_github('bmansfeld/QTLseqr', ref='main', dependencies=TRUE, upgrade='always') \
110
- }, error = function(e) { \
111
- message('First attempt failed: ', e$message); \
112
  tryCatch({ \
113
- remotes::install_github('bmansfeld/QTLseqr', ref='main', dependencies=FALSE, upgrade='never') \
114
  }, error = function(e) { \
115
- message('Second attempt failed: ', e$message); \
116
- # Install from CRAN if available \
117
- install.packages('QTLseqr', repos='https://cloud.r-project.org') \
 
 
 
 
 
 
 
118
  }) \
119
- })" > install_QTLseqr.log 2>&1 && cat install_QTLseqr.log
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  # Create www directory and health file
122
  RUN mkdir -p /code/www && echo "OK" > /code/www/health
@@ -127,5 +142,5 @@ COPY app.R /code/
127
  # Expose the port Shiny will run on
128
  EXPOSE 7860
129
 
130
- # Run the app with corrected host address
131
  CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]
 
3
  # Set working directory inside container
4
  WORKDIR /code
5
 
6
+ # Install additional system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  libcurl4-openssl-dev \
9
  libssl-dev \
 
21
  zlib1g-dev \
22
  libbz2-dev \
23
  libgit2-dev \
24
+ libudunits2-dev \
25
+ libgsl-dev \
26
  && apt-get clean \
27
  && rm -rf /var/lib/apt/lists/*
28
 
 
42
  promises \
43
  > install_dt.log 2>&1 || cat install_dt.log
44
 
45
+ # Install main packages
46
  RUN install2.r --error --repo https://cloud.r-project.org \
47
  nloptr \
48
  lme4 \
 
82
  qtl \
83
  > install_qtl.log 2>&1 || cat install_qtl.log
84
 
85
+ # Install QTLseqr from GitHub with specific error handling
 
 
 
 
 
 
 
 
86
  RUN R -e "options(timeout = 600); \
87
+ if (!requireNamespace('QTLseqr', quietly = TRUE)) { \
 
 
 
88
  tryCatch({ \
89
+ remotes::install_github('bmansfeld/QTLseqr') \
90
  }, error = function(e) { \
91
+ message('GitHub installation failed: ', e$message); \
92
+ # Try alternative repository or specific commit \
93
+ tryCatch({ \
94
+ remotes::install_github('bmansfeld/QTLseqr@HEAD') \
95
+ }, error = function(e) { \
96
+ message('Alternative installation failed: ', e$message); \
97
+ # Install dependencies manually first \
98
+ install.packages(c('data.table', 'ggplot2', 'dplyr', 'tidyr'), repos='https://cloud.r-project.org'); \
99
+ remotes::install_github('bmansfeld/QTLseqr', dependencies = FALSE) \
100
+ }) \
101
  }) \
102
+ }" > install_QTLseqr.log 2>&1 && cat install_QTLseqr.log
103
 
104
+ # Install qtlTools from GitHub with error handling
105
  RUN R -e "options(timeout = 600); \
106
+ if (!requireNamespace('qtlTools', quietly = TRUE)) { \
 
 
 
107
  tryCatch({ \
108
+ remotes::install_github('jtlovell/qtlTools') \
109
  }, error = function(e) { \
110
+ message('GitHub installation failed: ', e$message); \
111
+ # Try installing from CRAN if available \
112
+ tryCatch({ \
113
+ install.packages('qtlTools', repos='https://cloud.r-project.org') \
114
+ }, error = function(e) { \
115
+ message('CRAN installation also failed: ', e$message); \
116
+ # Install minimal dependencies and try again \
117
+ install.packages(c('qtl', 'dplyr', 'tidyr'), repos='https://cloud.r-project.org'); \
118
+ remotes::install_github('jtlovell/qtlTools', dependencies = FALSE) \
119
+ }) \
120
  }) \
121
+ }" > install_qtlTools.log 2>&1 && cat install_qtlTools.log
122
+
123
+ # Verify installations
124
+ RUN R -e " \
125
+ cat('Checking package installations:\\n'); \
126
+ cat('QTLseqr available:', requireNamespace('QTLseqr', quietly = TRUE), '\\n'); \
127
+ cat('qtlTools available:', requireNamespace('qtlTools', quietly = TRUE), '\\n'); \
128
+ if (!requireNamespace('QTLseqr', quietly = TRUE)) { \
129
+ warning('QTLseqr not installed'); \
130
+ } \
131
+ if (!requireNamespace('qtlTools', quietly = TRUE)) { \
132
+ warning('qtlTools not installed'); \
133
+ } \
134
+ " > verify_install.log 2>&1 && cat verify_install.log
135
 
136
  # Create www directory and health file
137
  RUN mkdir -p /code/www && echo "OK" > /code/www/health
 
142
  # Expose the port Shiny will run on
143
  EXPOSE 7860
144
 
145
+ # Run the app
146
  CMD ["R", "--quiet", "-e", "shiny::runApp('/code', host='0.0.0.0', port=7860)"]