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

Simplify dockerfile #9

Merged
merged 1 commit into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 10 additions & 40 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
FROM mambaorg/micromamba:0.22.0

ARG MAMBA_DOCKERFILE_ACTIVATE=1

USER root
RUN apt-get update && apt-get install -y cmake
USER $MAMBA_USER
ARG PYTHON_VERSION=3.10

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

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

##################################################################
# Create emscripten env
# Create emscripten env and pack it
##################################################################

RUN micromamba create -n xeus-python-build-wasm \
RUN micromamba create -n xeus-python-kernel \
--platform=emscripten-32 \
-c https://repo.mamba.pm/emscripten-forge \
-c https://repo.mamba.pm/conda-forge \
--yes \
python=3.10 ipython pybind11 jedi xtl nlohmann_json \
pybind11_json xeus "xeus-python-shell>=0.3" \
python=$PYTHON_VERSION xeus-python \
numpy matplotlib

##################################################################
# git config
##################################################################
RUN git config --global advice.detachedHead false

##################################################################
# xeus-python build
##################################################################
RUN mkdir -p xeus-python && \
git clone --branch 0.13.8 --depth 1 https://github.com/jupyter-xeus/xeus-python.git xeus-python

RUN mkdir -p xeus-python/build && \
cd xeus-python/build && \
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-build-wasm && \
export CMAKE_PREFIX_PATH=$PREFIX && \
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX && \
/tmp/emsdk/emsdk activate 3.1.2 && \
source /tmp/emsdk/emsdk_env.sh && \
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DCMAKE_PROJECT_INCLUDE=cmake/overwriteProp.cmake \
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON \
.. && \
make -j8

RUN cd xeus-python && \
python wasm_patches/patch_it.py

RUN cd xeus-python/build && \
RUN mkdir -p xeus-python-kernel && cd xeus-python-kernel && \
export FILE_PACKAGER=/tmp/emsdk/upstream/emscripten/tools/file_packager.py && \
emboa pack python core $MAMBA_ROOT_PREFIX/envs/xeus-python-build-wasm --version=3.10
/tmp/emsdk/emsdk activate 3.1.2 3.1.2 && \
cp $MAMBA_ROOT_PREFIX/envs/xeus-python-kernel/bin/xpython_wasm.js . && \
cp $MAMBA_ROOT_PREFIX/envs/xeus-python-kernel/bin/xpython_wasm.wasm . && \
emboa pack python core $MAMBA_ROOT_PREFIX/envs/xeus-python-kernel --version=$PYTHON_VERSION

COPY copy_output.sh .

Expand Down
2 changes: 1 addition & 1 deletion copy_output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

mkdir -p /src/src

cd /tmp/xeus-python/build
cd /tmp/xeus-python-kernel
ls
cp *python*.{js,wasm,data} /src/src

Expand Down