-
Notifications
You must be signed in to change notification settings - Fork 3
/
arm64.Dockerfile
308 lines (269 loc) · 9.39 KB
/
arm64.Dockerfile
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
## -- This will:
## -- - Install Bioconductor using the rocker/rstudio image for arm64 platform.
## -- - This is copypasted and edited from https://github.com/Bioconductor/bioconductor_docker/commit/aa83033e4f8f7909847cec24eadba8cd3335a615
## -- - Install system deps for Ubuntu 20.04
## -- - Download the yq binary.
## -- - Install scdrake deps from renv lockfile into global R library.
## -- - Install the scdrake package.
## -- - Install the CLI scripts.
FROM --platform=linux/arm64 rocker/rstudio:latest-daily
## Set Dockerfile version number
ARG BIOCONDUCTOR_VERSION=3.15
ENV BIOCONDUCTOR_DOCKER_VERSION=$BIOCONDUCTOR_DOCKER_VERSION
ENV BIOCONDUCTOR_VERSION=$BIOCONDUCTOR_VERSION
##### IMPORTANT ########
## The PATCH version number should be incremented each time
## there is a change in the Dockerfile.
ARG BIOCONDUCTOR_PATCH=0
ARG BIOCONDUCTOR_DOCKER_VERSION=${BIOCONDUCTOR_VERSION}.${BIOCONDUCTOR_PATCH}
ARG SCDRAKE_VERSION
RUN test -n "$SCDRAKE_VERSION" || (echo "SCDRAKE_VERSION not set" && false)
ENV SCDRAKE_VERSION=$SCDRAKE_VERSION
LABEL name="jirinovo/scdrake" \
version=$SCDRAKE_VERSION \
bioconductor_version=$BIOCONDUCTOR_VERSION \
url="https://github.com/bioinfocz/scdrake" \
maintainer="jiri.novotny@img.cas.cz" \
description="Scdrake package wrapped in arm64 Bioconductor docker image." \
license="MIT"
ARG PROXY_BUILD
ENV ALL_PROXY=${PROXY_BUILD}
ENV http_proxy=${PROXY_BUILD}
ENV https_proxy=${PROXY_BUILD}
## Do not use binary repositories during container creation
## Avoid using binaries produced for older version of same container
ENV BIOCONDUCTOR_USE_CONTAINER_REPOSITORY=FALSE
## START https://github.com/Bioconductor/bioconductor_docker/blob/master/bioc_scripts/install_bioc_sysdeps.sh
## Add Bioconductor system dependencies
# This is to avoid the error
# 'debconf: unable to initialize frontend: Dialog'
ENV DEBIAN_FRONTEND=noninteractive
## Update apt-get
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils
## Basic Deps
RUN apt-get install -y --no-install-recommends \
gdb \
libxml2-dev \
python3-pip \
libz-dev \
liblzma-dev \
libbz2-dev \
libpng-dev \
libgit2-dev
## sys deps from bioc_full
RUN apt-get install -y --no-install-recommends \
pkg-config \
fortran77-compiler \
byacc \
automake \
curl \
cmake
## This section installs libraries
RUN apt-get install -y --no-install-recommends \
libpcre2-dev \
libnetcdf-dev \
libhdf5-serial-dev \
libfftw3-dev \
libopenbabel-dev \
libopenmpi-dev \
libxt-dev \
libudunits2-dev \
libgeos-dev \
libproj-dev \
libcairo2-dev \
libtiff5-dev \
libreadline-dev \
libgsl0-dev \
libgslcblas0 \
libgtk2.0-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libgmp3-dev \
libhdf5-dev \
libncurses-dev \
libxpm-dev \
liblapack-dev \
libv8-dev \
libgtkmm-2.4-dev \
libmpfr-dev \
libmodule-build-perl \
libapparmor-dev \
libprotoc-dev \
librdf0-dev \
libmagick++-dev \
libsasl2-dev \
libpoppler-cpp-dev \
libprotobuf-dev \
libpq-dev \
libarchive-dev
## software - perl extentions and modules
RUN apt-get install -y --no-install-recommends \
libperl-dev \
libarchive-extract-perl \
libfile-copy-recursive-perl \
libcgi-pm-perl \
libdbi-perl \
libdbd-mysql-perl \
libxml-simple-perl
## new libs
RUN apt-get install -y --no-install-recommends \
libglpk-dev \
libeigen3-dev
## Databases and other software
RUN apt-get install -y --no-install-recommends \
sqlite \
openmpi-bin \
mpi-default-bin \
openmpi-common \
openmpi-doc \
tcl8.6-dev \
tk-dev \
default-jdk \
imagemagick \
tabix \
ggobi \
graphviz \
protobuf-compiler \
jags \
libhiredis-dev
## Additional resources
RUN apt-get install -y --no-install-recommends \
xfonts-100dpi \
xfonts-75dpi \
biber \
libsbml5-dev \
libzmq3-dev \
python3-dev \
python3-venv
## More additional resources
## libavfilter-dev - <infinityFlow, host of other packages>
## mono-runtime - <rawrr, MsBackendRawFileReader>
## libfuse-dev - <Travel>
## ocl-icd-opencl-dev - <gpuMagic> - but machine needs to be a GPU--otherwise it's useless
RUN apt-get install -y --no-install-recommends \
libmariadb-dev-compat \
libjpeg-dev \
libjpeg-turbo8-dev \
libjpeg8-dev \
libavfilter-dev \
libfuse-dev \
mono-runtime \
ocl-icd-opencl-dev
## Python installations
RUN curl --output /tmp/PySocks-1.7.1-py3-none-any.whl https://files.pythonhosted.org/packages/8d/59/b4572118e098ac8e46e399a1dd0f2d85403ce8bbaad9ec79373ed6badaf9/PySocks-1.7.1-py3-none-any.whl
RUN pip3 install /tmp/PySocks-1.7.1-py3-none-any.whl
RUN pip3 install scikit-learn pandas pyyaml
## libgdal is needed for sf
RUN apt-get install -y --no-install-recommends \
libgdal-dev \
default-libmysqlclient-dev \
libmysqlclient-dev
## END https://github.com/Bioconductor/bioconductor_docker/blob/master/bioc_scripts/install_bioc_sysdeps.sh
## Add host-site-library
RUN echo "R_LIBS=/usr/local/lib/R/host-site-library:\${R_LIBS}" > /usr/local/lib/R/etc/Renviron.site
## -- https://stackoverflow.com/questions/36725027/r-package-installation-from-source-using-multiple-cores
ARG R_PKG_INSTALL_MAKE_NCPUS=1
ENV MAKEFLAGS="-j${R_PKG_INSTALL_MAKE_NCPUS}"
RUN apt-get update && apt-get install -y --no-install-recommends ccache
ENV CC="ccache gcc"
ENV CXX="ccache g++"
## START https://github.com/Bioconductor/bioconductor_docker/blob/master/bioc_scripts/install.R
## -- For now we need a newer GitHub version because of https://github.com/Bioconductor/BiocManager/issues/142
ARG BIOCMANAGER_COMMIT=67faa90
RUN Rscript -e "install.packages('remotes', repos = 'https://cran.rstudio.com')"
RUN Rscript -e "remotes::install_github('Bioconductor/BiocManager@${BIOCMANAGER_COMMIT}', repos = 'https://cran.rstudio.com')"
RUN Rscript -e "BiocManager::install(version = '${BIOCONDUCTOR_VERSION}', update = TRUE, ask = FALSE)"
RUN Rscript -e "BiocManager::install('devtools')"
## END https://github.com/Bioconductor/bioconductor_docker/blob/master/bioc_scripts/install.R
# DEVEL: Add sys env variables to DEVEL image
# Variables in Renviron.site are made available inside of R.
# Add libsbml CFLAGS
RUN curl -O http://bioconductor.org/checkResults/devel/bioc-LATEST/Renviron.bioc \
&& sed -i '/^IS_BIOC_BUILD_MACHINE/d' Renviron.bioc \
&& cat Renviron.bioc | grep -o '^[^#]*' | sed 's/export //g' >>/etc/environment \
&& cat Renviron.bioc >> /usr/local/lib/R/etc/Renviron.site \
&& echo BIOCONDUCTOR_VERSION=${BIOCONDUCTOR_VERSION} >> /usr/local/lib/R/etc/Renviron.site \
&& echo BIOCONDUCTOR_DOCKER_VERSION=${BIOCONDUCTOR_DOCKER_VERSION} >> /usr/local/lib/R/etc/Renviron.site \
&& echo 'LIBSBML_CFLAGS="-I/usr/include"' >> /usr/local/lib/R/etc/Renviron.site \
&& echo 'LIBSBML_LIBS="-lsbml"' >> /usr/local/lib/R/etc/Renviron.site \
&& rm -rf Renviron.bioc
ENV LIBSBML_CFLAGS="-I/usr/include"
ENV LIBSBML_LIBS="-lsbml"
## -- scdrake stuff
## -- https://github.com/bioinfocz/scdrake/blob/main/required_libs_linux.md -> Ubuntu 20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
libglpk-dev \
libgmp3-dev \
libxml2-dev \
make \
libicu-dev \
pandoc \
libssl-dev \
libfontconfig1-dev \
libfreetype6-dev \
libpng-dev \
imagemagick \
libmagick++-dev \
gsfonts \
python3 \
zlib1g-dev \
libgeos-dev \
git \
libgit2-dev \
libzmq3-dev \
libfribidi-dev \
libharfbuzz-dev \
libjpeg-dev \
libtiff-dev \
qpdf
## clean up
RUN apt-get clean
RUN apt-get autoremove -y
RUN apt-get autoclean -y
RUN rm -rf /var/lib/apt/lists/*
RUN curl -L --output /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64
RUN test -s "/usr/local/bin/yq" || (echo "yq binary is empty" && false)
RUN chmod +x /usr/local/bin/yq
RUN mkdir -p /root/.local/bin
RUN ln -s /usr/local/bin/yq /root/.local/bin/yq
RUN mkdir -p /home/rstudio/.local/bin
RUN ln -s /usr/local/bin/yq /home/rstudio/.local/bin/yq
RUN chown -R rstudio:rstudio /home/rstudio/.local
ENV RENV_VERSION=0.16.0
RUN R -e "BiocManager::install('rstudio/renv@${RENV_VERSION}')"
ARG R_PKG_INSTALL_NCPUS=1
COPY renv.lock /
RUN Rscript -e "\
options(Ncpus = ${R_PKG_INSTALL_NCPUS}, renv.config.rspm.enabled = FALSE);\
renv::consent(TRUE);\
renv::restore(lockfile = 'renv.lock', exclude = 'BiocManager', prompt = FALSE, repos = BiocManager::repositories());\
"
RUN mkdir /scdrake_source
COPY DESCRIPTION /scdrake_source/DESCRIPTION
COPY inst /scdrake_source/inst
COPY man /scdrake_source/man
COPY NAMESPACE /scdrake_source/NAMESPACE
COPY R /scdrake_source/R
COPY tests /scdrake_source/tests
COPY vignettes /scdrake_source/vignettes
RUN Rscript -e "\
devtools::install(\
pkg = '/scdrake_source', dependencies = FALSE, upgrade = FALSE,\
keep_source = TRUE, build_vignettes = TRUE,\
repos = BiocManager::repositories()\
);\
"
## -- Strip shared libraries, see https://github.com/rocker-org/rocker-versioned2/issues/340
RUN find /usr/local/lib/R/site-library/*/libs/ -name \*.so | xargs strip -s -p
## -- Clear ccache
RUN ccache --clear
RUN Rscript -e "scdrake::install_cli(type = 'system', ask = FALSE)"
ENV MAKEFLAGS=""
ENV SCDRAKE_DOCKER=TRUE
ARG PROXY_IMAGE
ENV ALL_PROXY=${PROXY_IMAGE}
ENV http_proxy=${PROXY_IMAGE}
ENV https_proxy=${PROXY_IMAGE}
## -- This will start RStudio.
CMD ["/init"]