Skip to content

Commit e0a6d30

Browse files
authored
Dockerfile to support online hosting of c# jupyter
1 parent 869a2cc commit e0a6d30

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

Dockerfile

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM jupyter/scipy-notebook:45f07a14b422
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+
# Install .NET CLI dependencies
18+
RUN apt-get install -y --no-install-recommends \
19+
libc6 \
20+
libgcc1 \
21+
libgssapi-krb5-2 \
22+
libicu60 \
23+
libssl1.1 \
24+
libstdc++6 \
25+
zlib1g
26+
27+
RUN rm -rf /var/lib/apt/lists/*
28+
29+
# Install .NET Core SDK
30+
ENV DOTNET_SDK_VERSION 3.0.100
31+
32+
RUN curl -SL --output dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
33+
&& dotnet_sha512='766da31f9a0bcfbf0f12c91ea68354eb509ac2111879d55b656f19299c6ea1c005d31460dac7c2a4ef82b3edfea30232c82ba301fb52c0ff268d3e3a1b73d8f7' \
34+
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
35+
&& mkdir -p /usr/share/dotnet \
36+
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
37+
&& rm dotnet.tar.gz \
38+
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
39+
40+
# Enable detection of running in a container
41+
ENV DOTNET_RUNNING_IN_CONTAINER=true \
42+
# Enable correct mode for dotnet watch (only mode supported in a container)
43+
DOTNET_USE_POLLING_FILE_WATCHER=true \
44+
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
45+
NUGET_XMLDOC_MODE=skip \
46+
# Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id
47+
DOTNET_TRY_CLI_TELEMETRY_OPTOUT=true
48+
49+
# Trigger first run experience by running arbitrary cmd
50+
RUN dotnet help
51+
52+
# Copy notebooks
53+
54+
COPY . ${HOME}/Notebooks/
55+
56+
# Copy package sources
57+
58+
COPY ./NuGet.config ${HOME}/nuget.config
59+
60+
RUN chown -R ${NB_UID} ${HOME}
61+
USER ${USER}
62+
63+
# Install Microsoft.DotNet.Interactive
64+
RUN dotnet tool install -g dotnet-try --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json"
65+
66+
ENV PATH="${PATH}:${HOME}/.dotnet/tools"
67+
RUN echo "$PATH"
68+
69+
# Install kernel specs
70+
RUN dotnet try jupyter install
71+
72+
# Enable telemetry once we install jupyter for the image
73+
ENV DOTNET_TRY_CLI_TELEMETRY_OPTOUT=false
74+
75+
# Set root to Notebooks
76+
WORKDIR ${HOME}/Notebooks/

0 commit comments

Comments
 (0)