-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
125 lines (108 loc) · 3.8 KB
/
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
## -- This will:
## -- - 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.
## -- You can build the Dockerfile using
## docker-buildx build --progress plain --platform linux/amd64 \
## --build-arg R_PKG_INSTALL_NCPUS=8 --build-arg R_PKG_INSTALL_MAKE_NCPUS=4 --build-arg SCDRAKE_VERSION=<version> \
## -t jirinovo/scdrake:<version>-bioc3.15 -f Dockerfile
ARG BIOCONDUCTOR_VERSION=3_15
FROM bioconductor/bioconductor_docker:RELEASE_$BIOCONDUCTOR_VERSION
ARG SCDRAKE_VERSION
RUN test -n "$SCDRAKE_VERSION" || (echo "SCDRAKE_VERSION not set" && false)
ENV SCDRAKE_VERSION=$SCDRAKE_VERSION
LABEL name="bioinfocz/scdrake" \
version=$SCDRAKE_VERSION \
bioconductor_version=$BIOCONDUCTOR_VERSION \
url="https://github.com/bioinfocz/scdrake" \
maintainer="[email protected]" \
description="Scdrake package wrapped in the Bioconductor docker image." \
license="MIT"
ARG PROXY_BUILD
ENV ALL_PROXY=${PROXY_BUILD}
ENV http_proxy=${PROXY_BUILD}
ENV https_proxy=${PROXY_BUILD}
## -- 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 \
curl
## 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
ARG R_PKG_INSTALL_MAKE_NCPUS=1
ENV MAKEFLAGS="-j${R_PKG_INSTALL_MAKE_NCPUS}"
## -- For Rhtslib this error appears during renv::restore(): '/usr/bin/tar: Unexpected EOF in archive'\
RUN Rscript -e "BiocManager::install(c('Rhtslib', 'Rsamtools'), update = FALSE, ask = FALSE, Ncpus = ${R_PKG_INSTALL_NCPUS})"
## Use Bioconductor binary packages
ENV BIOCONDUCTOR_USE_CONTAINER_REPOSITORY=TRUE
COPY renv.lock /
RUN Rscript -e "\
options(Ncpus = ${R_PKG_INSTALL_NCPUS});\
renv::consent(TRUE);\
renv::restore(lockfile = 'renv.lock', prompt = FALSE);\
"
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 "\
options(Ncpus = ${R_PKG_INSTALL_NCPUS});\
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
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"]