1
1
FROM ghcr.io/darpa-askem/askem-julia:latest AS JULIA_BASE_IMAGE
2
2
3
-
4
3
FROM python:3.10
5
- RUN useradd -m jupyter
6
- EXPOSE 8888
7
- RUN mkdir -p /usr/local/share/jupyter/kernels && chmod -R 777 /usr/local/share/jupyter/kernels
8
4
5
+ USER root
6
+
7
+ # Install custom Julia
9
8
ENV JULIA_PATH=/usr/local/julia
10
9
ENV JULIA_DEPOT_PATH=/usr/local/julia
11
10
ENV JULIA_PROJECT=/home/jupyter/.julia/environments/askem
@@ -15,8 +14,6 @@ COPY --chown=1000:1000 --from=JULIA_BASE_IMAGE /ASKEM-Sysimage.so /Project.toml
15
14
RUN chmod -R 777 /usr/local/julia/logs
16
15
RUN ln -sf /usr/local/julia/bin/julia /usr/local/bin/julia
17
16
18
- WORKDIR /home/jupyter
19
-
20
17
# Install r-lang and kernel
21
18
RUN apt update && \
22
19
apt install -y r-base r-cran-irkernel \
@@ -25,35 +22,28 @@ RUN apt update && \
25
22
apt clean -y && \
26
23
apt autoclean -y
27
24
28
- WORKDIR /jupyter
25
+ # Switch to non-root user. It is crucial for security reasons to not run jupyter as root user!
26
+ RUN useradd -m jupyter
27
+ USER jupyter
29
28
30
- # Install Python requirements
31
- RUN pip install --upgrade --no-cache-dir hatch pip
29
+ # Install Mira from github
30
+ RUN git clone https://github.com/indralab/mira.git /home/jupyter/mira && \
31
+ pip install --no-cache-dir /home/jupyter/mira/"[ode,tests,dkg-client,sbml]" && \
32
+ rm -r /home/jupyter/mira
32
33
33
34
# Install project requirements
34
- COPY --chown=1000:1000 pyproject.toml README.md hatch_build.py /jupyter/
35
- # Hack to install requirements without requiring the rest of the files
36
- RUN pip install -e .
37
-
38
- # Install Mira from `hackathon` branch
39
- RUN git clone https://github.com/indralab/mira.git /mira && \
40
- pip install /mira/"[ode,tests,dkg-client,sbml]" && \
41
- rm -r /mira
35
+ COPY --chown=1000:1000 pyproject.toml README.md hatch_build.py /home/jupyter/askem_beaker/
36
+ COPY --chown=1000:1000 . /home/jupyter/askem_beaker/
42
37
43
- # Kernel must be placed in a specific spot in the filesystem
44
- # TODO: Replace this with helper that just copies the required file(s) via a python script?
45
- COPY beaker_kernel/kernel.json /usr/local/share/jupyter/kernels/beaker_kernel/kernel.json
38
+ # Installs the askem specific subkernels
39
+ RUN pip install --no-cache-dir --upgrade /home/jupyter/askem_beaker
46
40
47
- # Copy src code over
48
- COPY --chown=1000:1000 . /jupyter
49
- RUN chown -R 1000:1000 /jupyter
50
- RUN pip install .
41
+ # WORKDIR /askem_beaker
42
+ WORKDIR /home/jupyter
51
43
52
- # Switch to non-root user. It is crucial for security reasons to not run jupyter as root user!
53
- USER jupyter
54
44
55
45
# Install Julia kernel (as user jupyter)
56
46
RUN /usr/local/julia/bin/julia -J /home/jupyter/.julia/environments/askem/ASKEM-Sysimage.so -e 'using IJulia; IJulia.installkernel("julia"; julia=`/usr/local/julia/bin/julia -J /home/jupyter/.julia/environments/askem/ASKEM-Sysimage.so --threads=4`)'
57
47
58
- # Service
59
- CMD [ "python" , "service/main.py" , "--ip" , "0.0.0.0" ]
48
+ CMD [ "python" , "-m" , "beaker_kernel.server.main" , "--ip" , "0.0.0.0" ]
49
+
0 commit comments