Skip to content

Commit

Permalink
Merge pull request #4 from pocki/dotnet8
Browse files Browse the repository at this point in the history
Update to .Net 8
  • Loading branch information
pocki authored Feb 2, 2024
2 parents e833ecc + b48eded commit f915998
Show file tree
Hide file tree
Showing 20 changed files with 5,839 additions and 796 deletions.
84 changes: 52 additions & 32 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,89 @@ name: ci

on:
push:
branches: [ main ]

branches:
- main
- dotnet8

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
-
name: Prepare
- name: Prepare
id: prep
run: |
echo ::set-output name=datetag::$(date -u +'%Y%m%d')
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
echo name=datetag::$(date -u +'%Y%m%d') >> $GITHUB_OUTPUT
echo name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ghcr.io
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push minimal-dotnet
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push minimal-dotnet
id: docker_build_minimal
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5.1.0
with:
push: true
build-args: base_image=jupyter/minimal-notebook
tags: pocki/minimal-dotnet:latest, pocki/minimal-dotnet:${{ steps.prep.outputs.datetag }}
tags: ghcr.io/pocki/jupyter-dotnet:minimal-dotnet8-latest, ghcr.io/pocki/jupyter-dotnet:minimal-dotnet8-${{ steps.prep.outputs.datetag }}
labels: |
type: minimal
org.opencontainers.image.title=Jupyter .NET (minimal)
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
-
name: Image digest minimal-dotnet
platforms: linux/amd64

- name: Image digest minimal-dotnet
run: echo ${{ steps.docker_build_minimal.outputs.digest }}
-
name: Build and push scipy-dotnet

- name: Build and push scipy-dotnet
id: docker_build_scipy
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5.1.0
with:
push: true
build-args: base_image=jupyter/scipy-notebook
tags: pocki/scipy-dotnet:latest, pocki/scipy-dotnet:${{ steps.prep.outputs.datetag }}
tags: ghcr.io/pocki/jupyter-dotnet:scipy-dotnet8-latest, ghcr.io/pocki/jupyter-dotnet:scipy-dotnet8-${{ steps.prep.outputs.datetag }}
labels: |
type: scipy
org.opencontainers.image.title=Jupyter .NET (SciPy)
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
-
name: Image digest scipy-dotnet
platforms: linux/amd64

- name: Image digest scipy-dotnet
run: echo ${{ steps.docker_build_scipy.outputs.digest }}
-
name: Build and push r-dotnet

- name: Build and push r-dotnet
id: docker_build_r
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5.1.0
with:
push: true
build-args: base_image=jupyter/r-notebook
tags: pocki/r-dotnet:latest, pocki/r-dotnet:${{ steps.prep.outputs.datetag }}
tags: ghcr.io/pocki/jupyter-dotnet:r-dotnet8-latest, ghcr.io/pocki/jupyter-dotnet:r-dotnet8-${{ steps.prep.outputs.datetag }}
labels: |
type: r
org.opencontainers.image.title=Jupyter .NET (R)
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
-
name: Image digest r-dotnet
platforms: linux/amd64

- name: Image digest r-dotnet
run: echo ${{ steps.docker_build_r.outputs.digest }}
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#build with: docker build --build-arg base_image=jupyter/minimal-notebook -t pocki/minimal-dotnet:latest -t pocki/minimal-dotnet:20210523 .
#build with: docker build --build-arg base_image=jupyter/scipy-notebook -t pocki/scipy-dotnet:latest -t pocki/scipy-dotnet:20210523 .
#build with: docker build --build-arg base_image=jupyter/r-notebook -t pocki/r-dotnet:latest -t pocki/r-dotnet:20210523 .
#build with: docker build --build-arg base_image=jupyter/minimal-notebook -t pocki/minimal-dotnet8:latest -t pocki/minimal-dotnet8:20210523 .
#build with: docker build --build-arg base_image=jupyter/scipy-notebook -t pocki/scipy-dotnet8:latest -t pocki/scipy-dotnet8:20210523 .
#build with: docker build --build-arg base_image=jupyter/r-notebook -t pocki/r-dotnet8:latest -t pocki/r-dotnet8:20210523 .

ARG base_image=jupyter/minimal-notebook
FROM ${base_image} as base
Expand All @@ -27,24 +27,26 @@ ENV \
# Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id
DOTNET_TRY_CLI_TELEMETRY_OPTOUT=true

# Install .NET CLI dependencies
# Install .NET CLI dependencies for Ubuntu 22.04
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libc6 \
libgcc1 \
libgcc-s1 \
libgssapi-krb5-2 \
libicu70 \
liblttng-ust1 \
libssl3 \
libstdc++6 \
libunwind8 \
zlib1g \
libgdiplus \
&& rm -rf /var/lib/apt/lists/*

ENV DOTNET_SDK_VERSION 7.0.405
ENV DOTNET_SDK_VERSION 8.0.101
# Install .NET Core SDK
RUN dotnet_sdk_version=7.0.405 \
RUN dotnet_sdk_version=8.0.101 \
&& curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \
&& dotnet_sha512='6cdf82af56f920c87315209f5b5166126e97b13b6d715b6507ddbc9a2eb618f812e43686b79de810ae6a21e0fb5a8e04d68a004f00a07533c8b664f9c889b5b0' \
&& dotnet_sha512='26df0151a3a59c4403b52ba0f0df61eaa904110d897be604f19dcaa27d50860c82296733329cb4a3cf20a2c2e518e8f5d5f36dfb7931bf714a45e46b11487c9a' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -ozxf dotnet.tar.gz -C /usr/share/dotnet \
Expand All @@ -66,7 +68,7 @@ USER ${USER}
RUN pip install nteract_on_jupyter

# Install lastest build from main branch of Microsoft.DotNet.Interactive
RUN dotnet tool install -g Microsoft.dotnet-interactive --version 1.0.456201
RUN dotnet tool install -g Microsoft.dotnet-interactive

ENV PATH="${PATH}:${HOME}/.dotnet/tools"
#RUN echo "$PATH"
Expand Down
3 changes: 1 addition & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key="MachineLearning" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json" />
<add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />\
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />\
Expand Down
53 changes: 41 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
# Jupyter Docker Stacks with .NET kernel

Extending the [Jupyter Docker Stack images](https://github.com/jupyter/docker-stacks) with .NET 7 kernel to run notebooks in C#, F# and Powershell
Extending the [Jupyter Docker Stack images](https://github.com/jupyter/docker-stacks) with .NET 8 kernel to run notebooks in C#, F# and Powershell

.NET kernel is provided by [.NET Interactive](https://github.com/dotnet/interactive)
.NET 6 kernel in tag 20220210 and later
.NET 7 kernel in tag 20230315 and later

## Actual following images are created:
* [minimal-dotnet](https://hub.docker.com/r/pocki/minimal-dotnet) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/pocki/minimal-dotnet) based on jupyter/minimal-notebook
* [scipy-dotnet](https://hub.docker.com/r/pocki/scipy-dotnet)![Docker Image Version (latest by date)](https://img.shields.io/docker/v/pocki/scipy-dotnet) based on jupyter/scipy-notebook
* [r-dotnet](https://hub.docker.com/r/pocki/r-dotnet) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/pocki/r-dotnet) based on jupyter/r-notebook

All images contain some .NET sample notebooks.

## Get started

This images can be started as the original Jupyter Docker Stack images (see the Jupyter Docker Stacks [ReadTheDocs](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html))

```
docker run -p 8888:8888 pocki/minimal-dotnet:latest
docker run -p 8888:8888 ghcr.io/pocki/jupyter-dotnet:minimal-dotnet8-latest
```

To persistant the notebooks mount the directory: `/home/jovyan/Notebooks`
```
docker run -p 8888:8888 pocki/scipy-dotnet:latest -v "$PWD":/home/jovyan/Notebooks
docker run -p 8888:8888 ghcr.io/pocki/jupyter-dotnet:r-dotnet8-latest -v "$PWD":/home/jovyan/Notebooks
```

All images contain some .NET sample notebooks in folder `/home/jovyan/Notebooks`.

# .NET 8

New: Docker Images have new name and changed to ghcr.io

Check available images on [Packages](https://github.com/pocki/jupyter-dotnet/pkgs/container/jupyter-dotnet):

* ghcr.io/pocki/jupyter-dotnet:minimal-dotnet8-latest
* ghcr.io/pocki/jupyter-dotnet:scipy-dotnet8-latest
* ghcr.io/pocki/jupyter-dotnet:r-dotnet8-latest

Every image type is also available with the build date in the tag do use static/fixed versions. Ex.:
* ghcr.io/pocki/jupyter-dotnet:minimal-dotnet8-20240202
* ghcr.io/pocki/jupyter-dotnet:scipy-dotnet8-20240202
* ghcr.io/pocki/jupyter-dotnet:r-dotnet8-20240202

On build there is always the latest available version of base image, .NET and dotnet interactive used.

# .NET 6/.NET 7

.NET 6 kernel in tag 20220210 and later
.NET 7 kernel in tag 20230315 and later

Docker Images are on Docker Hub

## Following images are created:
* [minimal-dotnet](https://hub.docker.com/r/pocki/minimal-dotnet) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/pocki/minimal-dotnet) based on jupyter/minimal-notebook
* [scipy-dotnet](https://hub.docker.com/r/pocki/scipy-dotnet)![Docker Image Version (latest by date)](https://img.shields.io/docker/v/pocki/scipy-dotnet) based on jupyter/scipy-notebook
* [r-dotnet](https://hub.docker.com/r/pocki/r-dotnet) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/pocki/r-dotnet) based on jupyter/r-notebook

### Usage:
Like above but images are on Docker Hub:
```
docker run -p 8888:8888 pocki/minimal-dotnet:latest
```

Loading

0 comments on commit f915998

Please sign in to comment.