Skip to content

Commit af02cfc

Browse files
authored
Merge pull request #53 from DARPA-ASKEM/refactor/askem-beaker-kernel-contexts
Refactor/askem beaker kernel contexts
2 parents 07efb5e + a31dafd commit af02cfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+31
-9935
lines changed

Dockerfile

+18-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
FROM ghcr.io/darpa-askem/askem-julia:latest AS JULIA_BASE_IMAGE
22

3-
43
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
84

5+
USER root
6+
7+
# Install custom Julia
98
ENV JULIA_PATH=/usr/local/julia
109
ENV JULIA_DEPOT_PATH=/usr/local/julia
1110
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
1514
RUN chmod -R 777 /usr/local/julia/logs
1615
RUN ln -sf /usr/local/julia/bin/julia /usr/local/bin/julia
1716

18-
WORKDIR /home/jupyter
19-
2017
# Install r-lang and kernel
2118
RUN apt update && \
2219
apt install -y r-base r-cran-irkernel \
@@ -25,35 +22,28 @@ RUN apt update && \
2522
apt clean -y && \
2623
apt autoclean -y
2724

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
2928

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
3233

3334
# 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/
4237

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
4640

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
5143

52-
# Switch to non-root user. It is crucial for security reasons to not run jupyter as root user!
53-
USER jupyter
5444

5545
# Install Julia kernel (as user jupyter)
5646
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`)'
5747

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+

beaker_kernel/kernel.json

-8
This file was deleted.

0 commit comments

Comments
 (0)