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

Commit 98d28a7

Browse files
authored
Merge pull request #9 from martinRenou/update_dockerfile
Simplify dockerfile
2 parents 8ce4612 + 8812449 commit 98d28a7

File tree

2 files changed

+11
-41
lines changed

2 files changed

+11
-41
lines changed

Dockerfile

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
FROM mambaorg/micromamba:0.22.0
44

55
ARG MAMBA_DOCKERFILE_ACTIVATE=1
6-
7-
USER root
8-
RUN apt-get update && apt-get install -y cmake
9-
USER $MAMBA_USER
6+
ARG PYTHON_VERSION=3.10
107

118
RUN micromamba install --yes -c https://repo.mamba.pm/conda-forge \
12-
git pip python=3.10 click typer
9+
git pip python=$PYTHON_VERSION click typer
1310

1411
##################################################################
1512
# Install emboa
@@ -27,50 +24,23 @@ RUN git clone https://github.com/emscripten-core/emsdk.git && \
2724
popd
2825

2926
##################################################################
30-
# Create emscripten env
27+
# Create emscripten env and pack it
3128
##################################################################
3229

33-
RUN micromamba create -n xeus-python-build-wasm \
30+
RUN micromamba create -n xeus-python-kernel \
3431
--platform=emscripten-32 \
3532
-c https://repo.mamba.pm/emscripten-forge \
3633
-c https://repo.mamba.pm/conda-forge \
3734
--yes \
38-
python=3.10 ipython pybind11 jedi xtl nlohmann_json \
39-
pybind11_json xeus "xeus-python-shell>=0.3" \
35+
python=$PYTHON_VERSION xeus-python \
4036
numpy matplotlib
4137

42-
##################################################################
43-
# git config
44-
##################################################################
45-
RUN git config --global advice.detachedHead false
46-
47-
##################################################################
48-
# xeus-python build
49-
##################################################################
50-
RUN mkdir -p xeus-python && \
51-
git clone --branch 0.13.8 --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 && \
38+
RUN mkdir -p xeus-python-kernel && cd xeus-python-kernel && \
7239
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
40+
/tmp/emsdk/emsdk activate 3.1.2 3.1.2 && \
41+
cp $MAMBA_ROOT_PREFIX/envs/xeus-python-kernel/bin/xpython_wasm.js . && \
42+
cp $MAMBA_ROOT_PREFIX/envs/xeus-python-kernel/bin/xpython_wasm.wasm . && \
43+
emboa pack python core $MAMBA_ROOT_PREFIX/envs/xeus-python-kernel --version=$PYTHON_VERSION
7444

7545
COPY copy_output.sh .
7646

copy_output.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
mkdir -p /src/src
55

6-
cd /tmp/xeus-python/build
6+
cd /tmp/xeus-python-kernel
77
ls
88
cp *python*.{js,wasm,data} /src/src
99

0 commit comments

Comments
 (0)