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

Commit

Permalink
Simplify dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed May 16, 2022
1 parent 8ce4612 commit c030339
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 41 deletions.
47 changes: 7 additions & 40 deletions Dockerfile
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,20 @@ 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
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
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

0 comments on commit c030339

Please sign in to comment.