Commit c5ba2f18 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

sunny 0.3.1-dev2



Signed-off-by: default avatarSteven Hahn <hahnse@ornl.gov>
parent dc0b4799
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
from savannah.ornl.gov/gravitas/jupyter-notebook:25.2.1
FROM savannah.ornl.gov/gravitas/jupyter-notebook:25.2.1

run apt-get update -y && \
RUN apt-get update -y && \
    apt-get upgrade -y && \
    apt-get install -y g++
    apt-get install -y g++ tini xorg-dev mesa-utils xvfb libgl1 freeglut3-dev

user jovyan
ENV XDG_RUNTIME_DIR=/run/user/0
RUN mkdir -p $XDG_RUNTIME_DIR

USER jovyan

ENV JULIA_CPU_TARGET="x86-64-v3"
run julia -e 'using Pkg; Pkg.Registry.update(); \
    Pkg.add([Pkg.PackageSpec(;name="JLLWrappers", version="1.7.0"), \
             Pkg.PackageSpec(;name="Sunny", version="0.7.5"), \
ENV DISPLAY=:0

RUN julia -e 'using Pkg; Pkg.Registry.update(); \
    Pkg.add([Pkg.PackageSpec(;name="Sunny", version="0.7.5"), \
             Pkg.PackageSpec(;name="MKL"), \
             Pkg.PackageSpec(;name="WGLMakie"), \
             Pkg.PackageSpec(;name="PackageCompiler"), \
             Pkg.PackageSpec(;url="https://github.com/quantumsteve/Bonito.jl",rev="jupyter_base_url")])'

RUN tini -v -- xvfb-run -s '-screen 0 1024x768x24' julia -e 'using Pkg; Pkg.add("GLMakie"); Pkg.precompile()'

ADD precompile ./precompile

run julia -e 'using PackageCompiler; \
    create_sysimage(["IJulia", "Sunny", "WGLMakie", "MKL"], \
                      sysimage_path="/home/jovyan/sys_flux_plots.so", \
                      precompile_execution_file=["precompile/01_LSWT_CoRh2O4.jl", "precompile/02_LLD_CoRh2O4.jl"], \
                      cpu_target=ENV["JULIA_CPU_TARGET"])'
run julia -e 'using IJulia; IJulia.installkernel("Julia Sunny WGLMakie", "--sysimage=/home/jovyan/sys_flux_plots.so")'
RUN tini -v -- xvfb-run -s '-screen 0 1024x768x24' --auto-servernum julia -e 'using PackageCompiler; create_sysimage(["IJulia", "Sunny", "WGLMakie", "MKL"], sysimage_path="/home/jovyan/sys_flux_plots.so", precompile_execution_file=["precompile/01_LSWT_CoRh2O4.jl", "precompile/02_LLD_CoRh2O4.jl"], cpu_target=ENV["JULIA_CPU_TARGET"])'
RUN julia -e 'using IJulia; IJulia.installkernel("Julia Sunny WGLMakie", "--sysimage=/home/jovyan/sys_flux_plots.so")'

# Move the kernelspec out of ${HOME} to the system share location.
# Avoids problems with runtime UID change not taking effect properly
# on the .local folder in the jovyan home dir.
run mv "${HOME}/.local/share/jupyter/kernels/julia"* "${CONDA_DIR}/share/jupyter/kernels/"
run chmod -R go+rx "${CONDA_DIR}/share/jupyter"
run rm -rf "${HOME}/.local"
run fix-permissions "${JULIA_PKGDIR}" "${CONDA_DIR}/share/jupyter"
RUN mv "${HOME}/.local/share/jupyter/kernels/julia"* "${CONDA_DIR}/share/jupyter/kernels/"
RUN chmod -R go+rx "${CONDA_DIR}/share/jupyter"
RUN rm -rf "${HOME}/.local"
RUN fix-permissions "${JULIA_PKGDIR}" "${CONDA_DIR}/share/jupyter"

run chmod -R 777 /opt/julia
RUN chmod -R 777 /opt/julia

user root
USER root

run rm -rf precompile
RUN rm -rf precompile

COPY examples ./examples
run chmod -R 777 examples
RUN chmod -R 777 examples

ADD ./startup.sh /startup.sh
CMD /startup.sh

sunny/startup.sh

0 → 100755
+32 −0
Original line number Diff line number Diff line
#!/bin/bash

# The IPython image starts as privileged user.
# The parent Galaxy server is mounting data into /import with the same 
# permissions as the Galaxy server is running on.
# In case of 1450 as UID and GID we are fine, because our preconfigured ipython
# user owns this UID/GID. 
# (1450 is the user id the Galaxy-Docker Image is using)
# If /import is not owned by 1450 we need to create a new user with the same
# UID/GID as /import and make everything accessible to this new user.
#
# In the end the IPython Server is started as non-privileged user. Either
# with the UID 1450 (preconfigured jupyter user) or a newly created 'galaxy' user
# with the same UID/GID as /import.

export PATH=/home/jovyan/.local/bin:$PATH

python /get_notebook.py

#if [ ! -f /import/ipython_galaxy_notebook.ipynb ]; then
#    cp /home/$NB_USER/notebook.ipynb /import/ipython_galaxy_notebook.ipynb
#    chown $NB_USER /import/ipython_galaxy_notebook.ipynb
#fi

jupyter trust /import/ipython_galaxy_notebook.ipynb
##/monitor_traffic.sh &

export XDG_RUNTIME_DIR=/run/user/0
mkdir -p $XDG_RUNTIME_DIR

xvfb-run -s '-screen 0 1024x768x24' jupyter notebook --no-browser