Skip to content

Instantly share code, notes, and snippets.

@RobotOptimist
Created November 22, 2020 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobotOptimist/818873bd61e03a3c934d79d7612e4107 to your computer and use it in GitHub Desktop.
Save RobotOptimist/818873bd61e03a3c934d79d7612e4107 to your computer and use it in GitHub Desktop.
Binder Dotnet Dockerfile For Base Image
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-focal
USER root
RUN cd /tmp
# now get the key:
RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
# now install that key
RUN apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
# now remove the public key file exit the root shell
RUN rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
RUN sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install python3 python3-pip python3-dev ipython3 intel-mkl-64bit-2020.0-088
RUN find /opt -name "libiomp5.so"
RUN ldconfig /opt/intel/compilers_and_libraries_2020.0.166/linux/compiler/lib/intel64_lin/
RUN pip3 install --no-cache notebook
ARG NB_USER=jovyan
ARG NB_UID=1000
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER
USER $NB_USER
ENV HOME=/home/$NB_USER
WORKDIR $HOME
ENV PATH="${PATH}:$HOME/.dotnet/tools/"
RUN dotnet tool install -g --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" dotnet-interactive
RUN dotnet-interactive jupyter install
@oddrationale
Copy link

I found this from your blog post, which is well written, btw! There wasn't a way to leave a comment on the blog post, so I'm posting here.

I found an even easier way to run .NET Interactive on Binder and thought you might be interested.

My method uses the fact that you can install dotnet inside a conda environment using the conda-forge repository. So instead of creating a Docker image from scratch, you can just provide an environment.yml and Binder will create the environment.

You can see an example in my repo here. Either place these three files in the root of your repository, or create a .binder folder as I have done in my example. The postBuild script will install the .NET Interactive kernel. And the start script just sets some environment variables required by the kernel. Just another alternative to your already working method. Enjoy!

@RobotOptimist
Copy link
Author

Hey thank you so much! This is super helpful and I intend to edit my blog to include this information. I'd like to give you credit in the blog. Is it okay if I link your github profile to credit you?

@oddrationale
Copy link

Sure, man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment