-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
120 lines (96 loc) · 3.31 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
FROM rdsc_gpu_base:latest
# compile lightgbm GPU R package
# https://lightgbm.readthedocs.io/en/latest/GPU-Tutorial.html
RUN git clone --recursive https://github.com/microsoft/LightGBM
RUN cd LightGBM && \
Rscript build_r.R --use-gpu
# install xgboost GPU R package
# xgboost branch
RUN git clone --recursive https://github.com/dmlc/xgboost
RUN mkdir -p xgboost/build && \
cd xgboost/build && \
cmake .. -DUSE_CUDA=ON -DR_LIB=ON -DUSE_NCCL=ON && \
make install -j$(nproc)
# clean up
RUN rm -rf xgboost
RUN rm -rf LightGBM
# install keras/tensorflow
RUN R -q -e "install.packages(\"keras\")"
# switch user
USER ${RSESSION_USER}
# install keras (when pip virtualenv is already installed)
RUN R -q -e "keras::install_keras(tensorflow = \"gpu\")"
# switch back
USER root
# finally, install required R packages
ARG packages="data.table"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
ARG packages="future \
future.apply"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
# ARG packages="gpuR"
# RUN for package in $packages; do \
# R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
# done && \
# rm -rf /tmp/*
ARG packages="h2o"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
ARG packages="mlr3misc \
mlr3verse \
mlbench \
MLmetrics"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
ARG packages="RcppRoll"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
ARG packages="tidyr"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
ARG packages="qpdf"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
ARG packages="vroom"
RUN for package in $packages; do \
R -q -e "p <- \"$package\"; remotes::update_packages(packages = p, upgrade = \"always\")"; \
done && \
rm -rf /tmp/*
# install my own stuff
RUN R -q -e "devtools::install_github(repo = \"mlr3learners/mlr3learners.lightgbm\", ref = \"development\")"
########################
USER ${RSESSION_USER}
# install python stuff
RUN yes | pip install \
scikit-learn
########################
# clear caches
RUN conda clean -ya
USER root
RUN rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /root/.cache/pip/* && \
rm -rf /home/${USER}/.cache/pip/* && \
conda clean -ya && \
apt-get clean && apt-get autoclean && apt-get autoremove -y
########################
ENTRYPOINT tail -f /dev/null
# docker GPU not working with docker-compose
# docker run --rm --gpus all -p 8787:8787 -v ~/R:/home/user/volume rdsc_gpu
# debug: docker run --rm --gpus all -p 8787:8787 -e PASSWORD=password rdsc_gpu