-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
121 lines (86 loc) · 4.09 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
# build as:
# sudo docker build --tag abarth/divand-jupyterhub:$(date --utc +%Y-%m-%dT%H%M) --tag abarth/divand-jupyterhub:latest .
FROM jupyterhub/singleuser:3.1
MAINTAINER Alexander Barth <[email protected]>
EXPOSE 8888
USER root
RUN apt-get update
RUN apt-get install -y libnetcdf-dev netcdf-bin unzip
RUN apt-get install -y ca-certificates curl libnlopt0 make gcc
RUN apt-get install -y emacs-nox git g++
ENV JUPYTER /opt/conda/bin/jupyter
ENV PYTHON /opt/conda/bin/python
ENV LD_LIBRARY_PATH /opt/conda/lib/
RUN conda install -c conda-forge ncurses
RUN conda install -y ipywidgets
RUN conda install -y matplotlib
RUN conda install -c conda-forge jupyterlab-git
RUN wget -O /usr/share/emacs/site-lisp/julia-mode.el https://raw.githubusercontent.com/JuliaEditorSupport/julia-emacs/master/julia-mode.el
# Install julia
ADD install_julia.sh .
RUN bash install_julia.sh; rm install_julia.sh
# install packages as user (to that the user can temporarily update them if necessary)
# and precompilation
USER jovyan
ENV LD_LIBRARY_PATH=
ENV JULIA_PACKAGES="CSV DataAssim DIVAnd DataStructures FFTW FileIO Glob HTTP IJulia ImageIO Images Interact Interpolations JSON Knet MAT Missings NCDatasets PackageCompiler PhysOcean PyCall PyPlot Roots SpecialFunctions StableRNGs VideoIO"
RUN julia --eval 'using Pkg; Pkg.add(split(ENV["JULIA_PACKAGES"]))'
USER root
# avoid warning
# curl: /opt/conda/lib/libcurl.so.4: no version information available (required by curl)
RUN mv -i /opt/conda/lib/libcurl.so.4 /opt/conda/lib/libcurl.so.4-conda
# remove unused kernel
RUN rm -R /opt/conda/share/jupyter/kernels/python3
# Download notebooks
RUN mkdir -p /home/$NB_USER/
RUN cd /home/$NB_USER/; \
wget -O master.zip https://github.com/gher-ulg/Diva-Workshops/archive/master.zip; unzip master.zip; \
rm /home/$NB_USER/master.zip
RUN mv /home/$NB_USER/Diva-Workshops-master/notebooks /home/$NB_USER
RUN rm -r /home/$NB_USER/Diva-Workshops-master
USER jovyan
ADD emacs /home/jovyan/.emacs
RUN mkdir -p /home/jovyan/.julia/config
ADD startup.jl /home/jovyan/.julia/config/startup.jl
RUN julia --eval 'using Pkg; pkg"precompile"'
USER root
# Example Data
RUN mkdir /data
RUN mkdir /data/Diva-Workshops-data
RUN curl https://dox.ulg.ac.be/index.php/s/Px6r7MPlpXAePB2/download | tar -C /data/Diva-Workshops-data -zxf -
RUN ln -s /opt/julia-* /opt/julia
USER jovyan
RUN julia -e 'using IJulia; IJulia.installkernel("Julia with 4 CPUs",env = Dict("JULIA_NUM_THREADS" => "4"))'
# Pre-compiled image with PackageCompiler
RUN julia --eval 'using Pkg; pkg"add PackageCompiler"'
ADD DIVAnd_precompile_script.jl .
ADD make_sysimg.sh .
RUN ./make_sysimg.sh
RUN mkdir -p /home/jovyan/.local
RUN mv sysimg_DIVAnd.so DIVAnd_precompile_script.jl make_sysimg.sh DIVAnd_trace_compile.jl /home/jovyan/.local
RUN rm -f test.xml Water_body_Salinity.3Danl.nc Water_body_Salinity.4Danl.cdi_import_errors_test.csv Water_body_Salinity.4Danl.nc Water_body_Salinity2.4Danl.nc
RUN julia -e 'using IJulia; IJulia.installkernel("Julia-DIVAnd precompiled", "--sysimage=/home/jovyan/.local/sysimg_DIVAnd.so")'
RUN julia -e 'using IJulia; IJulia.installkernel("Julia-DIVAnd precompiled, 4 CPUs)", "--sysimage=/home/jovyan/.local/sysimg_DIVAnd.so",env = Dict("JULIA_NUM_THREADS" => "4"))'
#ENV JUPYTER_ENABLE_LAB yes
USER root
ADD run_galaxy.sh /usr/local/bin/run_galaxy.sh
USER jovyan
## use 33 (www-data) as nextcloud
#USER root
## user id 33 -> 200 (unused)
#RUN usermod -u 200 www-data
#RUN groupmod -g 200 www-data
## user id 1000 -> 33
#RUN usermod -u 33 jovyan
#RUN find /home /var /tmp -user 1000 -exec chown 33.100 {} \;
#RUN find /home /var /tmp -user 33 -exec chown 200.200 {} \;
##RUN ls -ld /home
#USER jovyan
COPY ./healthcheck_notebook.sh /bin/healthcheck.sh
HEALTHCHECK --interval=30s --timeout=10s CMD /bin/healthcheck.sh
# issue https://github.com/gher-uliege/DIVAnd-jupyterhub/issues/6
# This should not be necessary anymore for julia 1.9
# We are assuming the python is compiled with a newer libstdc++ than julia
# (otherwise the file should not be removed)
RUN ["/bin/sh","-c","rm /opt/julia-1.8.*/lib/julia/libstdc++.so.*"]
CMD ["bash", "/usr/local/bin/run_galaxy.sh"]