This commit is contained in:
@@ -9,14 +9,6 @@ jobs:
|
|||||||
"Build Jupyter Sage docker images":
|
"Build Jupyter Sage docker images":
|
||||||
runs-on: woryzen
|
runs-on: woryzen
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
driver: docker-container
|
|
||||||
-
|
-
|
||||||
name: Login to Gitea container registry
|
name: Login to Gitea container registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -28,10 +20,12 @@ jobs:
|
|||||||
name: Build and push jupyter-sage image
|
name: Build and push jupyter-sage image
|
||||||
uses: docker/build-push-action@v5.3.0
|
uses: docker/build-push-action@v5.3.0
|
||||||
with:
|
with:
|
||||||
|
builder: multiplatform-builder
|
||||||
context: "{{defaultContext}}:jupyter-sage"
|
context: "{{defaultContext}}:jupyter-sage"
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
pull: true
|
build-args: "VERSION=10.8"
|
||||||
tags: gitea.woggioni.net/woggioni/jupyter-sage:latest
|
ssh: default=/home/luser/.ssh/id_ed25519
|
||||||
cache-from: type=registry,ref=gitea.woggioni.net/woggioni/jupyter-sage:buildx
|
tags: |
|
||||||
cache-to: type=registry,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true,ref=gitea.woggioni.net/woggioni/jupyter-sage:buildx
|
gitea.woggioni.net/woggioni/jupyter-sage:latest
|
||||||
|
gitea.woggioni.net/woggioni/jupyter-sage:10.8
|
||||||
|
|||||||
@@ -1,36 +1,44 @@
|
|||||||
FROM debian:latest
|
FROM debian:stable AS build
|
||||||
RUN apt-get update && apt-get upgrade
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
RUN apt-get install -y bc binutils bzip2 ca-certificates cliquer cmake curl \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
ecl eclib-tools fflas-ffpack g++ gap gcc gengetopt gfan gfortran \
|
apt update &&\
|
||||||
glpk-utils gmp-ecm lcalc libatomic-ops-dev libboost-dev \
|
apt install -y python3 python3-dev pipx gcc g++ libffi-dev cargo cmake autoconf swig ninja-build patchelf meson python3-faiss adduser
|
||||||
libbraiding-dev libbrial-dev libbrial-groebner-dev libbz2-dev \
|
RUN adduser -u 1000 --system --shell /bin/sh --home /home/jovyan jovyan
|
||||||
libcdd-dev libcdd-tools libcliquer-dev libcurl4-openssl-dev libec-dev \
|
|
||||||
libecm-dev libffi-dev libflint-dev libfplll-dev libfreetype-dev \
|
|
||||||
libgap-dev libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev \
|
|
||||||
libglpk-dev libgmp-dev libgsl-dev libhomfly-dev libiml-dev \
|
|
||||||
liblfunction-dev liblinbox-dev liblrcalc-dev liblzma-dev libm4ri-dev \
|
|
||||||
libm4rie-dev libmpc-dev libmpfi-dev libmpfr-dev libncurses5-dev \
|
|
||||||
libntl-dev libopenblas-dev libpari-dev libplanarity-dev libppl-dev \
|
|
||||||
libprimesieve-dev libpython3-dev libqhull-dev libreadline-dev \
|
|
||||||
librw-dev libsingular4-dev libsqlite3-dev libssl-dev \
|
|
||||||
libsuitesparse-dev libsymmetrica2-dev libz-dev libzmq3-dev m4 make \
|
|
||||||
maxima maxima-sage meson nauty ninja-build openssl palp pari-doc \
|
|
||||||
pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch \
|
|
||||||
patchelf perl pkg-config planarity ppl-dev python3 python3-setuptools \
|
|
||||||
python3-venv singular singular-doc sqlite3 sympow tachyon tar texinfo \
|
|
||||||
tox xcas xz-utils git
|
|
||||||
RUN apt-get install -y default-jdk dvipng ffmpeg fonts-freefont-otf \
|
|
||||||
imagemagick latexmk libavdevice-dev libjpeg-dev pandoc tex-gyre \
|
|
||||||
texlive-fonts-recommended texlive-lang-cyrillic texlive-lang-english \
|
|
||||||
texlive-lang-european texlive-lang-french texlive-lang-german \
|
|
||||||
texlive-lang-italian texlive-lang-japanese texlive-lang-polish \
|
|
||||||
texlive-lang-portuguese texlive-lang-spanish texlive-latex-extra \
|
|
||||||
texlive-luatex texlive-xetex xindy
|
|
||||||
RUN useradd jovyan -u 1000 -s /bin/bash -m -h /home/jovyan
|
|
||||||
USER jovyan
|
USER jovyan
|
||||||
WORKDIR /home/jovyan
|
WORKDIR /home/jovyan
|
||||||
COPY build.sh build.sh
|
RUN python3 -m venv venv
|
||||||
RUN git clone -c core.symlinks=true --filter blob:none \
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install sagemath
|
||||||
--origin upstream --branch master --tags \
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyter-core
|
||||||
https://github.com/sagemath/sage.git
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyterhub
|
||||||
RUN export srcdir=/home/jovyan/sage source build.sh && prepare && build
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyterlab
|
||||||
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install notebook
|
||||||
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install ipywidgets
|
||||||
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyterlab-lsp
|
||||||
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install python-lsp-server[yapf,rope,pyflakes]
|
||||||
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyter-ai
|
||||||
|
RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install langchain-openai langchain_ollama
|
||||||
|
|
||||||
|
ENV PATH="/home/jovyan/venv/bin/:$PATH"
|
||||||
|
|
||||||
|
FROM debian:stable
|
||||||
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
|
apt update &&\
|
||||||
|
apt install -y python3 adduser
|
||||||
|
RUN adduser -u 1000 --system --shell /bin/sh --home /home/jovyan jovyan
|
||||||
|
USER jovyan
|
||||||
|
COPY --from=build /home/jovyan /home/jovyan
|
||||||
|
COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/
|
||||||
|
COPY start-notebook.py start-singleuser.py /usr/local/bin/
|
||||||
|
RUN mkdir /home/jovyan/work
|
||||||
|
WORKDIR /home/jovyan/work
|
||||||
|
ENV JUPYTER_PORT=8888
|
||||||
|
EXPOSE $JUPYTER_PORT
|
||||||
|
ENV PATH="/home/jovyan/venv/bin/:$PATH"
|
||||||
|
CMD ["start-notebook.py"]
|
||||||
|
|
||||||
|
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
|
||||||
|
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands
|
||||||
|
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
|
||||||
|
HEALTHCHECK --interval=3s --timeout=1s --start-period=3s --retries=3 \
|
||||||
|
CMD /etc/jupyter/docker_healthcheck.py || exit 1
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
pkgs=(standard
|
# pkgs=(
|
||||||
bliss
|
# standard
|
||||||
coxeter3
|
# bliss
|
||||||
mcqd
|
# coxeter3
|
||||||
meataxe
|
# mcqd
|
||||||
sirocco
|
# meataxe
|
||||||
tdlib)
|
# sirocco
|
||||||
|
# tdlib
|
||||||
|
# )
|
||||||
|
|
||||||
prepare(){
|
prepare() {
|
||||||
cd sage
|
cd "${srcdir}"
|
||||||
# use correct latte-count binary name
|
# use correct latte-count binary name
|
||||||
# patch -p1 -i ../latte-count.patch
|
# patch -p1 -i ../latte-count.patch
|
||||||
# update to tdlib 0.9 (Fedora)
|
# update to tdlib 0.9 (Fedora)
|
||||||
@@ -23,29 +26,17 @@ prepare(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
export SAGE_NUM_THREADS=$(($(nproc)/2))
|
#export SAGE_NUM_THREADS=$(($(nproc)/2))
|
||||||
export PYTHONPATH="$PWD"/sage/pkgs/sage-setup
|
#export PYTHONPATH="$PWD"/sage/pkgs/sage-setup
|
||||||
|
python3 -m build --wheel --no-isolation -C setup-args=-Dbuild-docs=false
|
||||||
for _pkg in ${_pkgs[@]}; do
|
|
||||||
cd "$srcdir"/sage/pkgs/sagemath-$_pkg
|
|
||||||
python setup.py build
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
for _pkg in ${_pkgs[@]}; do
|
python -m installer dist/*.whl
|
||||||
cd "$srcdir"/sage/pkgs/sagemath-$_pkg
|
|
||||||
python setup.py install --root="$pkgdir" --optimize=1
|
|
||||||
done
|
|
||||||
|
|
||||||
# fix symlinks to assets
|
|
||||||
# _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
|
|
||||||
# for _i in $(ls "$srcdir"/sage/src/sage/ext_data/notebook-ipython); do
|
|
||||||
# rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i
|
|
||||||
# ln -s $_pythonpath/sage/ext_data/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/
|
|
||||||
# done
|
|
||||||
|
|
||||||
# adjust threejs version
|
|
||||||
# rm "$pkgdir"$_pythonpath/sage/ext_data/threejs/threejs-version.txt
|
|
||||||
# ln -s /usr/share/threejs-sage/version "$pkgdir"$_pythonpath/sage/ext_data/threejs/threejs-version.txt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
|
||||||
|
build
|
||||||
|
|
||||||
|
package
|
||||||
|
|||||||
44
jupyter-sage/start-notebook.py
Executable file
44
jupyter-sage/start-notebook.py
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright (c) Jupyter Development Team.
|
||||||
|
# Distributed under the terms of the Modified BSD License.
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# If we are in a JupyterHub, we pass on to `start-singleuser.py` instead so it does the right thing
|
||||||
|
if "JUPYTERHUB_API_TOKEN" in os.environ:
|
||||||
|
print(
|
||||||
|
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub."
|
||||||
|
)
|
||||||
|
command = ["/usr/local/bin/start-singleuser.py"] + sys.argv[1:]
|
||||||
|
os.execvp(command[0], command)
|
||||||
|
|
||||||
|
|
||||||
|
# Entrypoint is start.sh
|
||||||
|
command = []
|
||||||
|
|
||||||
|
# If we want to survive restarts, launch the command using `run-one-constantly`
|
||||||
|
if os.environ.get("RESTARTABLE") == "yes":
|
||||||
|
command.append("run-one-constantly")
|
||||||
|
|
||||||
|
# We always launch a jupyter subcommand from this script
|
||||||
|
command.append("jupyter")
|
||||||
|
|
||||||
|
# Launch the configured subcommand.
|
||||||
|
# Note that this should be a single string, so we don't split it.
|
||||||
|
# We default to `lab`.
|
||||||
|
jupyter_command = os.environ.get("DOCKER_STACKS_JUPYTER_CMD", "lab")
|
||||||
|
command.append(jupyter_command)
|
||||||
|
|
||||||
|
# Append any optional NOTEBOOK_ARGS we were passed in.
|
||||||
|
# This is supposed to be multiple args passed on to the notebook command,
|
||||||
|
# so we split it correctly with shlex
|
||||||
|
if "NOTEBOOK_ARGS" in os.environ:
|
||||||
|
command += shlex.split(os.environ["NOTEBOOK_ARGS"])
|
||||||
|
|
||||||
|
# Pass through any other args we were passed on the command line
|
||||||
|
command += sys.argv[1:]
|
||||||
|
|
||||||
|
# Execute the command!
|
||||||
|
print("Executing: " + " ".join(command))
|
||||||
|
os.execvp(command[0], command)
|
||||||
Reference in New Issue
Block a user