Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit f078741

Browse files
authored
Merge pull request #3 from martinRenou/docker_build
Add Docker build
2 parents 91400ba + 22f364e commit f078741

14 files changed

+5632
-15808
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ dmypy.json
114114
_output
115115
*.doit.db
116116

117-
xeus_python.js
118-
xeus_python.wasm
119-
xeus_python.worker.js
117+
python_data.js
118+
python_data.data
119+
xpython_wasm.js
120+
xpython_wasm.wasm
121+
xeus_python.worker.js

Dockerfile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# TODO Try to combine micromamba and emsdk
2+
# FROM emscripten/emsdk:2.0.32
3+
FROM mambaorg/micromamba:0.22.0
4+
5+
ARG MAMBA_DOCKERFILE_ACTIVATE=1
6+
7+
USER root
8+
RUN apt-get update && apt-get install -y cmake
9+
USER $MAMBA_USER
10+
11+
RUN micromamba install --yes -c https://repo.mamba.pm/conda-forge \
12+
git pip python=3.10 click typer
13+
14+
##################################################################
15+
# Install emboa
16+
##################################################################
17+
18+
RUN pip install git+https://github.com/emscripten-forge/emboa
19+
20+
##################################################################
21+
# Setup emsdk
22+
##################################################################
23+
24+
RUN git clone https://github.com/emscripten-core/emsdk.git && \
25+
pushd emsdk && \
26+
./emsdk install 3.1.2 && \
27+
popd
28+
29+
##################################################################
30+
# Create build env
31+
##################################################################
32+
33+
RUN micromamba create -n xeus-python-build-wasm \
34+
--platform=emscripten-32 \
35+
-c https://repo.mamba.pm/emscripten-forge \
36+
-c https://repo.mamba.pm/conda-forge \
37+
--yes \
38+
python=3.10 ipython pybind11 jedi xtl nlohmann_json \
39+
pybind11_json numpy xeus "xeus-python-shell>=0.3"
40+
41+
##################################################################
42+
# git config
43+
##################################################################
44+
RUN git config --global advice.detachedHead false
45+
46+
##################################################################
47+
# xeus-python build
48+
##################################################################
49+
# TODO Use a tag that is not master
50+
RUN mkdir -p xeus-python && \
51+
git clone --branch master --depth 1 https://github.com/jupyter-xeus/xeus-python.git xeus-python
52+
53+
RUN mkdir -p xeus-python/build && \
54+
cd xeus-python/build && \
55+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-build-wasm && \
56+
export CMAKE_PREFIX_PATH=$PREFIX && \
57+
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX && \
58+
/tmp/emsdk/emsdk activate 3.1.2 && \
59+
source /tmp/emsdk/emsdk_env.sh && \
60+
emcmake cmake \
61+
-DCMAKE_BUILD_TYPE=Release \
62+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
63+
-DCMAKE_PROJECT_INCLUDE=cmake/overwriteProp.cmake \
64+
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON \
65+
.. && \
66+
make -j8
67+
68+
RUN cd xeus-python && \
69+
python wasm_patches/patch_it.py
70+
71+
RUN cd xeus-python/build && \
72+
export FILE_PACKAGER=/tmp/emsdk/upstream/emscripten/tools/file_packager.py && \
73+
emboa pack python core $MAMBA_ROOT_PREFIX/envs/xeus-python-build-wasm --version=3.10
74+
75+
COPY copy_output.sh .
76+
77+
ENTRYPOINT ["/bin/bash"]

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ The [xeus-python](https://github.com/jupyter-xeus/xeus-python) Python kernel for
66

77
![jupyterlite-xeus-python](https://user-images.githubusercontent.com/21197331/167814755-76975633-30f7-4f8e-8fdb-eeec98fa3fd1.gif)
88

9-
109
## Requirements
1110

1211
- JupyterLite >= 0.1.0a14

build.sh renamed to copy_output.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/bash
2-
32
set -e
43

5-
64
mkdir -p /src/src
75

8-
9-
cd /xeus-python-build
10-
cp *.{js,wasm} /src/src
6+
cd /tmp/xeus-python/build
7+
ls
8+
cp *python*.{js,wasm,data} /src/src
119

1210
echo "============================================="
1311
echo "Compiling wasm bindings done"
14-
echo "============================================="
12+
echo "============================================="

0 commit comments

Comments
 (0)