-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
139 lines (120 loc) · 3.36 KB
/
Dockerfile
File metadata and controls
139 lines (120 loc) · 3.36 KB
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
ARG CONDA_VERSION=py311_23.9.0-0
#########################################
# Base
#########################################
FROM docker.io/opensuse/leap:15.4 AS base
# Install general utilities:
# - R depends on which
# - rdwd update needs on tar, gzip
# - R help needs less
# - rdwd needs unzip
RUN zypper refresh && \
zypper --non-interactive install \
which less \
tar gzip unzip \
&& \
zypper clean --all
#########################################
# Conda environment
#########################################
FROM base AS conda
# Install conda
ARG CONDA_VERSION
RUN curl https://repo.anaconda.com/miniconda/Miniconda3-$CONDA_VERSION-Linux-x86_64.sh -o conda.sh && \
bash conda.sh -b -p /conda && \
rm conda.sh && \
/conda/bin/conda clean -afy
# Create base R environment
ARG R_VERSION
RUN . /conda/etc/profile.d/conda.sh && \
conda create -p /conda/env -c conda-forge --override-channels --no-default-packages \
r-base=$R_VERSION \
&& \
/conda/bin/conda clean -afy
# Install common conda-available packages
RUN . /conda/etc/profile.d/conda.sh && \
conda activate /conda/env && \
conda install -c conda-forge --override-channels \
r-devtools \
r-remotes \
r-rcpp \
r-pbapply \
r-tidyverse \
r-sf \
r-terra \
&& \
/conda/bin/conda clean -afy
# Install other conda-available packages
RUN . /conda/etc/profile.d/conda.sh && \
conda activate /conda/env && \
conda install -c conda-forge --override-channels \
r-dplyr \
r-lubridate \
r-jsonlite \
r-foreign \
r-berryfunctions \
r-xml \
r-lhs \
r-furrr \
r-gensa \
r-genalg \
r-raster \
r-igraph \
r-progressr \
r-rcpparmadillo \
r-boot \
r-numbers \
r-foreach \
r-dtwclust \
r-pls \
r-mnormt \
r-tensora \
r-nnet \
r-quantreg \
r-locfit \
r-optparse \
&& \
/conda/bin/conda clean -afy
# Install non-conda-available packages
RUN . /conda/etc/profile.d/conda.sh && \
conda activate /conda/env && \
Rscript -e 'install.packages(c( \
"nlrx", \
"rdwd" \
), repos="https://cloud.r-project.org")' && \
/conda/bin/conda clean -afy
# Update rdwd
RUN . /conda/etc/profile.d/conda.sh && \
conda activate /conda/env && \
Rscript -e 'library(rdwd); updateRdwd()'
# Clean files not needed runtime
RUN find -L /conda/env/ -type f -name '*.a' -delete -print && \
find -L /conda/env/ -type f -name '*.js.map' -delete -print
#########################################
# Final container image
#########################################
FROM base
# Java
ARG JAVA_VERSION
RUN zypper refresh && \
zypper --non-interactive install \
java-$JAVA_VERSION-openjdk-headless \
&& \
zypper clean --all
# NetLogo
ARG NETLOGO_FILE
ARG NETLOGO_VERSION
ADD $NETLOGO_FILE /
# Conda
COPY --from=conda /conda/env/ /conda/env/
# HyperQueue
ARG HQ_FILE
ADD $HQ_FILE /conda/env/bin/
ENV JAVA_HOME=/usr/lib64/jvm/java-$JAVA_VERSION-openjdk-$JAVA_VERSION \
NETLOGO_HOME="/NetLogo $NETLOGO_VERSION" \
NETLOGO_VERSION=$NETLOGO_VERSION \
PROJ_DATA=/conda/env/share/proj \
PATH=/conda/env/bin:$PATH \
LC_ALL=C.UTF-8
ENTRYPOINT ["Rscript"]
CMD ["--help"]