Skip to content

Commit 6dd09b4

Browse files
authored
Updated and separated dockerfile to make install of notebooks significantly faster (#21)
1 parent e2f1b11 commit 6dd09b4

File tree

3 files changed

+90
-70
lines changed

3 files changed

+90
-70
lines changed

Dockerfile

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,12 @@
1-
FROM jupyter/base-notebook:latest
2-
3-
# Install .NET CLI dependencies
1+
FROM csharpfritz/fritznotebook:latest
42

3+
# Set the environment variables
54
ARG NB_USER=jovyan
65
ARG NB_UID=1000
76
ENV USER ${NB_USER}
87
ENV NB_UID ${NB_UID}
98
ENV HOME /home/${NB_USER}
109

11-
WORKDIR ${HOME}
12-
13-
USER root
14-
RUN apt-get update
15-
RUN apt-get install -y curl
16-
17-
ENV \
18-
# Enable detection of running in a container
19-
DOTNET_RUNNING_IN_CONTAINER=true \
20-
# Enable correct mode for dotnet watch (only mode supported in a container)
21-
DOTNET_USE_POLLING_FILE_WATCHER=true \
22-
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
23-
NUGET_XMLDOC_MODE=skip \
24-
# Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id
25-
DOTNET_TRY_CLI_TELEMETRY_OPTOUT=true
26-
27-
# Install .NET CLI dependencies
28-
RUN apt-get update \
29-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
30-
libc6 \
31-
libgcc1 \
32-
libgssapi-krb5-2 \
33-
libicu66 \
34-
libssl1.1 \
35-
libstdc++6 \
36-
zlib1g \
37-
&& rm -rf /var/lib/apt/lists/*
38-
39-
# Install .NET Core SDK
40-
41-
# When updating the SDK version, the sha512 value a few lines down must also be updated.
42-
ENV DOTNET_SDK_VERSION 3.1.301
43-
44-
RUN dotnet_sdk_version=3.1.301 \
45-
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \
46-
&& dotnet_sha512='dd39931df438b8c1561f9a3bdb50f72372e29e5706d3fb4c490692f04a3d55f5acc0b46b8049bc7ea34dedba63c71b4c64c57032740cbea81eef1dce41929b4e' \
47-
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
48-
&& mkdir -p /usr/share/dotnet \
49-
&& tar -ozxf dotnet.tar.gz -C /usr/share/dotnet \
50-
&& rm dotnet.tar.gz \
51-
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
52-
# Trigger first run experience by running arbitrary cmd
53-
&& dotnet help
54-
55-
# Copy package sources
56-
57-
COPY ./NuGet.config ${HOME}/nuget.config
58-
59-
60-
#Install nteract
61-
RUN pip install nteract_on_jupyter
62-
63-
# Install lastest build from master branch of Microsoft.DotNet.Interactive from myget
64-
RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json"
65-
66-
#latest stable from nuget.org
67-
#RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://api.nuget.org/v3/index.json"
68-
69-
ENV PATH="${PATH}:${HOME}/.dotnet/tools"
70-
RUN echo "$PATH"
71-
72-
# Install kernel specs
73-
RUN dotnet interactive jupyter install
74-
75-
# Enable telemetry once we install jupyter for the image
76-
ENV DOTNET_TRY_CLI_TELEMETRY_OPTOUT=false
77-
7810
# Set root to notebooks
7911
WORKDIR ${HOME}/notebooks/
8012

base/Dockerfile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
FROM jupyter/base-notebook:latest
2+
3+
# Install .NET CLI dependencies
4+
5+
ARG NB_USER=jovyan
6+
ARG NB_UID=1000
7+
ENV USER ${NB_USER}
8+
ENV NB_UID ${NB_UID}
9+
ENV HOME /home/${NB_USER}
10+
11+
WORKDIR ${HOME}
12+
13+
USER root
14+
# RUN apt-get update
15+
# RUN apt-get install -y curl
16+
17+
ENV \
18+
# Enable detection of running in a container
19+
DOTNET_RUNNING_IN_CONTAINER=true \
20+
# Enable correct mode for dotnet watch (only mode supported in a container)
21+
DOTNET_USE_POLLING_FILE_WATCHER=true \
22+
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
23+
NUGET_XMLDOC_MODE=skip \
24+
# Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id
25+
DOTNET_TRY_CLI_TELEMETRY_OPTOUT=true
26+
27+
# Install .NET CLI dependencies
28+
RUN apt-get update \
29+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
30+
curl \
31+
libc6 \
32+
libgcc1 \
33+
libgssapi-krb5-2 \
34+
libicu66 \
35+
libssl1.1 \
36+
libstdc++6 \
37+
zlib1g \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
# Install .NET Core SDK
41+
42+
# When updating the SDK version, the sha512 value a few lines down must also be updated.
43+
ENV DOTNET_SDK_VERSION 3.1.301
44+
45+
RUN dotnet_sdk_version=3.1.301 \
46+
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \
47+
&& dotnet_sha512='dd39931df438b8c1561f9a3bdb50f72372e29e5706d3fb4c490692f04a3d55f5acc0b46b8049bc7ea34dedba63c71b4c64c57032740cbea81eef1dce41929b4e' \
48+
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
49+
&& mkdir -p /usr/share/dotnet \
50+
&& tar -ozxf dotnet.tar.gz -C /usr/share/dotnet \
51+
&& rm dotnet.tar.gz \
52+
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
53+
# Trigger first run experience by running arbitrary cmd
54+
&& dotnet help
55+
56+
# Copy package sources
57+
58+
COPY ./NuGet.config ${HOME}/nuget.config
59+
60+
61+
#Install nteract
62+
RUN pip install nteract_on_jupyter
63+
64+
# Install lastest build from master branch of Microsoft.DotNet.Interactive from myget
65+
RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json"
66+
67+
#latest stable from nuget.org
68+
#RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://api.nuget.org/v3/index.json"
69+
70+
ENV PATH="${PATH}:${HOME}/.dotnet/tools"
71+
RUN echo "$PATH"
72+
73+
# Install kernel specs
74+
RUN dotnet interactive jupyter install
75+
76+
# Enable telemetry once we install jupyter for the image
77+
ENV DOTNET_TRY_CLI_TELEMETRY_OPTOUT=false
78+
79+
# # Set root to notebooks
80+
# WORKDIR ${HOME}/notebooks/
81+
82+
# # Copy notebooks
83+
# COPY ./notebooks/ ${HOME}/notebooks/
84+
# RUN chown -R ${NB_UID} ${HOME}
85+
# USER ${USER}

base/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Base Docker image
2+
3+
This folder contains the base docker configuration to run .NET Interactive notebooks using Jupyter and MyBinder

0 commit comments

Comments
 (0)